<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jul 9, 2014, at 3:41 AM, 苏焕然 <<a href="mailto:ownesss@gmail.com">ownesss@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I don't quite understand about __invoke bullet2 and bullet4.<div><br></div><div>for example, bullet2:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">template</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">class</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">_Fp</span><span class="" style="line-height:13px;white-space:pre">,</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">class</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">_A0</span><span class="" style="line-height:13px;white-space:pre">,</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">class</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">...</span><span class="" style="line-height:13px;white-space:pre">_Args</span><span class="" style="line-height:13px;white-space:pre">,<br>
</span><span class="" style="line-height:13px;white-space:pre">            </span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">class</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">=</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">typename</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">enable_if<br>
</span><span class="" style="line-height:13px;white-space:pre">            </span><span class="" style="line-height:13px;white-space:pre"><<br></span><span class="" style="line-height:13px;white-space:pre">                </span><span class="" style="line-height:13px;white-space:pre">is_member_function_pointer</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">typename</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">remove_reference</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre">_Fp</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">type</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">value</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">&&<br>
</span><span class="" style="line-height:13px;white-space:pre">                </span><span class="" style="line-height:13px;white-space:pre">!</span><span class="" style="line-height:13px;white-space:pre">is_base_of</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">typename</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">remove_reference</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">typename</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">__member_pointer_traits</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">typename</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">remove_reference</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre">_Fp</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">type</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">_ClassType</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">type</span><span class="" style="line-height:13px;white-space:pre">,<br>
</span><span class="" style="line-height:13px;white-space:pre">                           </span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">typename</font></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">remove_reference</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre">_A0</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">type</span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">value<br>
</span><span class="" style="line-height:13px;white-space:pre">            </span><span class="" style="line-height:13px;white-space:pre">>::</span><span class="" style="line-height:13px;white-space:pre">type<br></span><span class="" style="line-height:13px;white-space:pre">         </span><span class="" style="line-height:13px;white-space:pre">><br>
</span><span class="" style="line-height:13px;white-space:pre">_LIBCPP_INLINE_VISIBILITY<br></span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">auto<br></font></span><span class="" style="line-height:13px;white-space:pre">__invoke</span><span class="" style="line-height:13px;white-space:pre">(</span><span class="" style="line-height:13px;white-space:pre">_Fp</span><span class="" style="line-height:13px;white-space:pre">&&</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">__f</span><span class="" style="line-height:13px;white-space:pre">,</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">_A0</span><span class="" style="line-height:13px;white-space:pre">&&</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">__a0</span><span class="" style="line-height:13px;white-space:pre">,</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">_Args</span><span class="" style="line-height:13px;white-space:pre">&&</span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre">...</span><span class="" style="line-height:13px;white-space:pre">__args</span><span class="" style="line-height:13px;white-space:pre">)<br>
</span><span class="" style="line-height:13px;white-space:pre">    </span><span class="" style="line-height:13px;white-space:pre">-></span><span class="" style="line-height:13px;white-space:pre"> </span><span class="" style="line-height:13px;white-space:pre"><font color="#9900ff">decltype</font></span><span class="" style="line-height:13px;white-space:pre">(((*</span><span class="" style="line-height:13px;white-space:pre">_VSTD</span><span class="" style="line-height:13px;white-space:pre">::</span><span class="" style="line-height:13px;white-space:pre">forward</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre">_A0</span><span class="" style="line-height:13px;white-space:pre">>(</span><span class="" style="line-height:13px;white-space:pre">__a0</span><span class="" style="line-height:13px;white-space:pre">)).*</span><span class="" style="line-height:13px;white-space:pre">__f</span><span class="" style="line-height:13px;white-space:pre">)(</span><span class="" style="line-height:13px;white-space:pre">_VSTD</span><span class="" style="line-height:13px;white-space:pre">::</span><span class="" style="line-height:13px;white-space:pre">forward</span><span class="" style="line-height:13px;white-space:pre"><</span><span class="" style="line-height:13px;white-space:pre">_Args</span><span class="" style="line-height:13px;white-space:pre">>(</span><span class="" style="line-height:13px;white-space:pre">__args</span><span class="" style="line-height:13px;white-space:pre">)...));</span></blockquote>
<div><br></div><div>this functions invokes <b>f</b> with <b>(*a0).f(args) (</b>as written in header __functional_base)<b>, </b>so I guess that a0/A0 has the type of <i>Pointer to Class? (thus, of course, isn't a base class of himself)</i></div>
<div><br></div><div>Then why did <b>enable_if </b>just test if <i>ClassType</i> of <b>f </b>isn't a base class of <b>A0 </b>?</div><div>wouldn't </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
    && is_base_of<member_pointer_traits<_Fp>::ClassType, remove_pointer<A0>>::value</blockquote><div><br></div><div>be more accurate? also, wouldn't <Some_Class_C::*Fp, Some_Class_D, Some_Args...> makes the value of enable_if to be <font color="#9900ff">true</font>?</div>
<div><br></div><div>I must guess that there is something I hadn't taken into consideration ;> </div></div></blockquote><br></div><div>The enable_if conditions are taken directly from the description in the standard (using N3936 here), 20.9.2/1:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Define INVOKE (f, t1, t2, ..., tN) as follows:</div><div><br><span class="Apple-tab-span" style="white-space:pre">     </span>— (t1.*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is an object of<br>type T or a reference to an object of type T or a reference to an object of a type derived from T;<br><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>— ((*t1).*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is not one of<br>the types described in the previous item;</div><br><div><div><span class="Apple-tab-span" style="white-space:pre">       </span>— Bullet #3 elided</div></div><div><div><span class="Apple-tab-span" style="white-space:pre">  </span>— Bullet #4 elided</div></div><div><div><span class="Apple-tab-span" style="white-space:pre">  </span>— Bullet #5 elided</div></div><div><br></div><div>— Marshall</div><div><br></div></body></html>