<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[C++11 std::future]]></title><description><![CDATA[<p>Hi,</p>
<p>ich experimentiere gerade mit VS11 und Threads, und siehe da, ich vermute einen Bug gefunden zu haben. Es geht um diesen Code:</p>
<pre><code class="language-cpp">#include &lt;future&gt;
#include &lt;iostream&gt;

int foo(unsigned a, unsigned b)
{
	return 5;
}

int main()
{
	std::future&lt;int&gt; f = std::async(foo, 5, 7);
	std::cout &lt;&lt; f.get();
}
</code></pre>
<p>VS11 DevPreview sagt:</p>
<pre><code>1&gt;C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(96): error C2064: term does not evaluate to a function taking 1 arguments
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(121) : see reference to class template instantiation 'std::_Result_type&lt;__formal,_Fty,&lt;unnamed-symbol&gt;&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              __formal=false,
1&gt;              _Fty=int,
1&gt;              &lt;unnamed-symbol&gt;=int &amp;
1&gt;          ]
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(107) : see reference to class template instantiation 'std::_Result_ofx&lt;_Fty,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int,
1&gt;              _V0_t=int &amp;,
1&gt;              _V1_t=std::_Nil,
1&gt;              _V2_t=std::_Nil,
1&gt;              _V3_t=std::_Nil,
1&gt;              _V4_t=std::_Nil,
1&gt;              _V5_t=std::_Nil
1&gt;          ]
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(243) : see reference to class template instantiation 'std::_Result_of&lt;_Fty,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,&lt;unnamed-symbol&gt;,_Obj&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int,
1&gt;              _V0_t=int &amp;,
1&gt;              _V1_t=std::_Nil,
1&gt;              _V2_t=std::_Nil,
1&gt;              _V3_t=std::_Nil,
1&gt;              _V4_t=std::_Nil,
1&gt;              _V5_t=std::_Nil,
1&gt;              &lt;unnamed-symbol&gt;=std::_Nil,
1&gt;              _Obj=std::_Nil
1&gt;          ]
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(250) : see reference to class template instantiation 'std::_Result_of0&lt;_Fty&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int (int)
1&gt;          ]
1&gt;          main.cpp(11) : see reference to class template instantiation 'std::result_of&lt;_Fty&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int (int)
1&gt;          ]
1&gt;
1&gt;Build FAILED.
</code></pre>
<p>Aber GCC sagt: <a href="http://ideone.com/ANrPj" rel="nofollow">http://ideone.com/ANrPj</a> (Wegen dem <a href="http://stackoverflow.com/questions/3930700/stdfuture-exception-on-gcc-experimental-implementation-of-c0x" rel="nofollow">runtime_error</a>)</p>
<p>Und? Ist der Code nicht standardkonform? Hat VS11 einen so üblen Bug? Was los hier? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/299947/c-11-std-future</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 01:27:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/299947.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Feb 2012 17:35:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++11 std::future on Tue, 21 Feb 2012 17:36:06 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich experimentiere gerade mit VS11 und Threads, und siehe da, ich vermute einen Bug gefunden zu haben. Es geht um diesen Code:</p>
<pre><code class="language-cpp">#include &lt;future&gt;
#include &lt;iostream&gt;

int foo(unsigned a, unsigned b)
{
	return 5;
}

int main()
{
	std::future&lt;int&gt; f = std::async(foo, 5, 7);
	std::cout &lt;&lt; f.get();
}
</code></pre>
<p>VS11 DevPreview sagt:</p>
<pre><code>1&gt;C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(96): error C2064: term does not evaluate to a function taking 1 arguments
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(121) : see reference to class template instantiation 'std::_Result_type&lt;__formal,_Fty,&lt;unnamed-symbol&gt;&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              __formal=false,
1&gt;              _Fty=int,
1&gt;              &lt;unnamed-symbol&gt;=int &amp;
1&gt;          ]
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(107) : see reference to class template instantiation 'std::_Result_ofx&lt;_Fty,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int,
1&gt;              _V0_t=int &amp;,
1&gt;              _V1_t=std::_Nil,
1&gt;              _V2_t=std::_Nil,
1&gt;              _V3_t=std::_Nil,
1&gt;              _V4_t=std::_Nil,
1&gt;              _V5_t=std::_Nil
1&gt;          ]
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(243) : see reference to class template instantiation 'std::_Result_of&lt;_Fty,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,&lt;unnamed-symbol&gt;,_Obj&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int,
1&gt;              _V0_t=int &amp;,
1&gt;              _V1_t=std::_Nil,
1&gt;              _V2_t=std::_Nil,
1&gt;              _V3_t=std::_Nil,
1&gt;              _V4_t=std::_Nil,
1&gt;              _V5_t=std::_Nil,
1&gt;              &lt;unnamed-symbol&gt;=std::_Nil,
1&gt;              _Obj=std::_Nil
1&gt;          ]
1&gt;          C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xrefwrap(250) : see reference to class template instantiation 'std::_Result_of0&lt;_Fty&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int (int)
1&gt;          ]
1&gt;          main.cpp(11) : see reference to class template instantiation 'std::result_of&lt;_Fty&gt;' being compiled
1&gt;          with
1&gt;          [
1&gt;              _Fty=int (int)
1&gt;          ]
1&gt;
1&gt;Build FAILED.
</code></pre>
<p>Aber GCC sagt: <a href="http://ideone.com/ANrPj" rel="nofollow">http://ideone.com/ANrPj</a> (Wegen dem <a href="http://stackoverflow.com/questions/3930700/stdfuture-exception-on-gcc-experimental-implementation-of-c0x" rel="nofollow">runtime_error</a>)</p>
<p>Und? Ist der Code nicht standardkonform? Hat VS11 einen so üblen Bug? Was los hier? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2183991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2183991</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Tue, 21 Feb 2012 17:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to C++11 std::future on Tue, 21 Feb 2012 19:43:27 GMT]]></title><description><![CDATA[<p>cooky451 schrieb:</p>
<blockquote>
<p>Und? Ist der Code nicht standardkonform? Hat VS11 einen so üblen Bug? Was los hier? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
</blockquote>
<p>Du scheinst ja sehr überrascht zu sein, in einer Preview zu einem neuen Standard einen Fehler zu finden (wenn es denn einer ist)...</p>
<p>Probier es man mit</p>
<pre><code class="language-cpp">#include &lt;future&gt;
#include &lt;iostream&gt;

int foo(unsigned a, unsigned b)
{
    return 5;
}

int main()
{
    auto f = std::async(foo, 5, 7);
    std::cout &lt;&lt; f.get();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2184064</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2184064</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Tue, 21 Feb 2012 19:43:27 GMT</pubDate></item><item><title><![CDATA[Reply to C++11 std::future on Tue, 21 Feb 2012 19:51:18 GMT]]></title><description><![CDATA[<p>manni66 schrieb:</p>
<blockquote>
<p>Du scheinst ja sehr überrascht zu sein, in einer Preview zu einem neuen Standard einen Fehler zu finden (wenn es denn einer ist)...</p>
</blockquote>
<p>Nun ja, der Fehler ist ja mehr als offensichtlich.<br />
(Dein Code produziert genau den gleichen Fehler.)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2184068</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2184068</guid><dc:creator><![CDATA[cooky451]]></dc:creator><pubDate>Tue, 21 Feb 2012 19:51:18 GMT</pubDate></item></channel></rss>