<future> : async に2つ以上の引数を渡せない - by επιστημη

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 736356 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 4/11/2012 5:12:53 AM
Access Restriction Public

Description

#include <iostream>
#include <future>

using namespace std;

int main() {
  int a = 2;
  int b = 3;
  future<int> f0 = async([=](){ return a*b;}); // ok
  future<int> f1 = async([=](int x){ return x*b;}, a); // ok
  future<int> f2 = async([](int x, int y){ return x*y;}, a, b); // error: C2064
  cout << f0.get() << endl;
  cout << f1.get() << endl;
  cout << f2.get() << endl;
}
Sign in to post a comment.
Posted by Microsoft on 5/7/2012 at 1:49 AM
バグのご報告ありがとうございます。問題は修正されました。修正版はビジュアルスタジオ11最終版にてご利用いただけます。

この問題は、c++11の可変個引数のテンプレートをシミュレートするマクロの使用が原因ではありません。std::async()に対するc++11の標準仕様が故障しており、その仕様を実装したことによるものです。次回の会議でこの問題をライブラリーワーキンググループに報告します。 
     
ステファンT.ラバベジュ               
ビジュアルc++ライブラリー開発担当
Posted by Stephan [MSFT] on 4/25/2012 at 7:41 PM
Hi,

Thanks for reporting this bug. We've already fixed it, and the fix will be available in the final version of Visual Studio 11.

Interestingly, this problem wasn't caused by our use of macros to simulate C++11's variadic templates. In fact, the C++11 Standard's specification of std::async() was broken, and we implemented that broken specification. I will report this to the Library Working Group during their next meeting.

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 4/23/2012 at 3:34 AM
この度はフィードバックをお送りいただき、誠にありがとうございます。 現在、お送りいただきました報告内容に基づき問題を確認中ですので、しばらくお待ちください。 よろしくお願いいたします。


[Problem Description]:
#include #include using namespace std; int main() { int a = 2; int b = 3; future f0 = async([=](){ return a*b;}); // ok future f1 = async([=](int x){ return x*b;}, a); // ok future f2 = async([](int x, int y){ return x*y;}, a, b); // error: C2064 cout

[Repro Steps]:
see description

[Actual Results]:
async([](int x, int y){ return x*y;}, a, b); // error: C2064

[Expected Results]:
successfully compiled
async([](int x, int y){ return x*y;}, a, b); // error: C2064
successfully compiled
Posted by επιστημη on 4/11/2012 at 9:31 PM
and please check again for another points that use fake-variadic-template :)

Posted by MS-Moderator01 on 4/11/2012 at 5:48 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)