<div class="gmail_quote">On Fri, Apr 13, 2012 at 8:02 AM, John M. Dlugosz <span dir="ltr">&lt;<a href="mailto:mpbecey7gu@snkmail.com">mpbecey7gu@snkmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I&#39;m using Visual Studio 10, and Boost 1.49.  The following complete CPP file compiles without error:<br></blockquote><div><br>I don&#39;t have access to VS 10 so...bear with me...<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


=====<br>
#include &lt;boost/test/unit_test.hpp&gt;<br>
#include &quot;boost/thread/future.hpp&quot;<br>
#include &lt;boost/utility/result_of.hpp&gt;<br>
#include &lt;functional&gt;<br>
<br>
using boost::unique_future;<br>
<br>
template &lt;typename F&gt;<br>
unique_future&lt;typename boost::result_of&lt; F() &gt;::type&gt;<br>
foo (F&amp;&amp; f)<br>
 {<br>
 typedef typename boost::result_of&lt; F() &gt;::type RetType;<br>
 unique_future&lt;RetType&gt; future_result;<br>
 return std::move(future_result);<br>
 }<br>
<br>
template &lt;typename F, typename A1&gt;<br>
unique_future&lt;typename boost::result_of&lt; F(A1) &gt;::type&gt;<br>
foo (F&amp;&amp; f, A1&amp;&amp; a1)<br>
 {<br>
 return std::move(foo (std::tr1::bind(f,a1)));<br>
 }<br>
<br>
<br>
<br>
class C {};<br>
<br>
class D  : public C {<br>
public:<br>
   void mf() const  { }<br>
//   virtual void toxic()  { }<br>
   };<br>
<br>
<br>
void mainfunc()<br>
{<br>
<br>
    D* p;<br>
    foo (&amp;D::mf, p);<br>
<br>
}<br>
<br>
=====<br>
<br>
But, if you un-comment the definition of toxic, then it will not compile, giving instead:<br>
<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2825: &#39;F&#39;: must be a class or namespace when followed by &#39;::&#39;<br>
1&gt;          E:\boost_1_49\boost/utility/<u></u>result_of.hpp(90) : see reference to class template instantiation &#39;boost::detail::result_of_<u></u>nested_result&lt;F,FArgs&gt;&#39; being compiled<br>
1&gt;          with<br>
1&gt;          [<br>
1&gt;              F=void (__thiscall D::* &amp;)(void) const,<br></blockquote><div><br>Hmmm...I wonder if the problem is that F is bound to a *reference* to a pointer-to-member. Although then I&#39;m surprised things work without the base class or the virtual member function.<br>
<br>Try replacing &quot;F&quot; in your boost::result_of queries with boost::remove_reference&lt;F&gt;::type.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

1&gt;              FArgs=void (__thiscall D::* &amp;(D *&amp;))(void) const<br>
1&gt;          ]<br>
1&gt;          E:\boost_1_49\boost/utility/<u></u>detail/result_of_iterate.hpp(<u></u>33) : see reference to class template instantiation &#39;boost::detail::tr1_result_of_<u></u>impl&lt;F,FArgs,HasResultType&gt;&#39; being compiled<br>

1&gt;          with<br>
1&gt;          [<br>
1&gt;              F=void (__thiscall D::* &amp;)(void) const,<br>
1&gt;              FArgs=void (__thiscall D::* &amp;(D *&amp;))(void) const,<br>
1&gt;              HasResultType=false<br>
1&gt;          ]<br></blockquote><div><br>Also, see if changing line 25 in result_of_iterate.hpp (near the reference above) to<br><br>          mpl::or_&lt; is_pointer&lt; typename boost::remove_reference&lt;F&gt;::type &gt;, is_member_function_pointer&lt; typename boost::remove_reference&lt;F&gt;::type &gt; &gt;<br>
<br>from<br><br>          mpl::or_&lt; is_pointer&lt;F&gt;, is_member_function_pointer&lt;F&gt; &gt;<br><br>helps.<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

1&gt;          E:\boost_1_49\boost/utility/<u></u>detail/result_of_iterate.hpp(<u></u>75) : see reference to class template instantiation &#39;boost::tr1_result_of&lt;F&gt;&#39; being compiled<br>
1&gt;          with<br>
1&gt;          [<br>
1&gt;              F=void (__thiscall D::* &amp;(D *&amp;))(void) const<br>
1&gt;          ]<br>
1&gt;          threadpoolTest.cpp(39) : see reference to class template instantiation &#39;boost::result_of&lt;F&gt;&#39; being compiled<br>
1&gt;          with<br>
1&gt;          [<br>
1&gt;              F=void (__thiscall D::* &amp;(D *&amp;))(void) const<br>
1&gt;          ]<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2516: &#39;F&#39; : is not a legal base class<br>
1&gt;          E:\boost_1_49\boost/utility/<u></u>result_of.hpp(90) : see declaration of &#39;F&#39;<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2143: syntax error : missing &#39;,&#39; before &#39;::&#39;<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2903: &#39;result&#39; : symbol is neither a class template nor a function template<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2039: &#39;result&#39; : is not a member of &#39;`global namespace&#39;&#39;<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2504: &#39;result&#39; : base class undefined<br>
1&gt;E:\boost_1_49\boost/utility/<u></u>result_of.hpp(82): error C2143: syntax error : missing &#39;,&#39; before &#39;&lt;&#39;<br>
1&gt;threadpoolTest.cpp(39): error C2893: Failed to specialize function template &#39;boost::unique_future&lt;boost::<u></u>result_of&lt;F(T0)&gt;::type&gt; foo(F &amp;&amp;,A1 &amp;&amp;)&#39;<br>
1&gt;          With the following template arguments:<br>
1&gt;          &#39;void (__thiscall D::* &amp;)(void) const&#39;<br>
1&gt;          &#39;D *&amp;&#39;<br>
1&gt;threadpoolTest.cpp(39): error C2780: &#39;boost::unique_future&lt;boost::<u></u>result_of&lt;F(void)&gt;::type&gt; foo(F &amp;&amp;)&#39; : expects 1 arguments - 2 provided<br>
1&gt;          threadpoolTest.cpp(10) : see declaration of &#39;foo&#39;<br>
1&gt;<br>
1&gt;Build FAILED.<br>
<br>
<br>
Note that both the presence of a virtual function and a base class in necessary.  if toxic is present but C is not, then it still works.<br></blockquote><div><br>Again, this seems mysterious to me...<br><br>- Jeff<br><br>
</div></div>

