<div class="gmail_quote">On Fri, Apr 13, 2012 at 7:35 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">
The plot thickens:<br>
<br>
 � � � �class Universe : std::tr1::enable_shared_from_<u></u>this&lt;Universe&gt; {<br>
 � � � � � const int answer;<br>
 � � � �public:<br>
 � � � � � Universe (int a) : answer(a) {}<br>
 � � � � � std::string get_answer() const;<br>
 � � � � � void get_nothing() {}<br>
 � � � � � virtual void blahblah(); // !!!<br>
 � � � � � };<br>
<br>
<br>
<br>
<br>
 � � � �Universe u1(42);<br>
 � � � �foo (&amp;Universe::get_answer, &amp;u1);<br>
<br>
<br>
Regarding my previous post on the definitions of foo,<br>
if the class inherits from enable_shared_from this *and* contains a virtual function, then this call to foo doesn&#39;t work, giving funny template errors in boost::result_of.<br></blockquote><div><br>It&#39;s really not so funny :)<br>
<br>&amp;Universe::get_answer is not an object supporting function-call syntax, so using boost::result_of to query the result of function application is, strictly speaking, meaningless. Boost.Bind happens to have special support for pointers-to-member-functions, but not all Boost libraries do, since it&#39;s a relatively simple matter to wrap the pointer in boost::mem_fun (note: I&#39;ve actually forgotten the precise name).<br>
<br>Regarding your initial message, on how to generically get the result type of a function object *or* a pointer-to-member-function, you&#39;d need to create your own metafunction which dispatches to boost::result_of or Boost.FunctionTypes metafunctions depending on whether the argument is a pointer-to-member or not.<br>
<br>You could argue that the language should allow function-call syntax on pointers-to-member-functions (and pointers-to-member-objects) as it is allowed for ponters-to-functions, and...I might sympathize with you.<br><br>
[snip errors]<br><br>HTH,<br></div><br>- Jeff<br><br></div>