[cfe-dev] a question on __invoke
苏焕然
ownesss at gmail.com
Wed Jul 9 03:41:40 PDT 2014
I don't quite understand about __invoke bullet2 and bullet4.
for example, bullet2:
template <class _Fp, class _A0, class ..._Args,
> class = typename enable_if
> <
> is_member_function_pointer<typename remove_reference<_Fp>::type>::value &&
> !is_base_of<typename remove_reference<typename __member_pointer_traits<
> typename remove_reference<_Fp>::type>::_ClassType>::type,
> typename remove_reference<_A0>::type>::value
> >::type
> >
> _LIBCPP_INLINE_VISIBILITY
> auto
> __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
> -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(
> __args)...));
this functions invokes *f* with *(*a0).f(args) (*as written in header
__functional_base)*, *so I guess that a0/A0 has the type of *Pointer to
Class? (thus, of course, isn't a base class of himself)*
Then why did *enable_if *just test if *ClassType* of *f *isn't a base class
of *A0 *?
wouldn't
&& is_base_of<member_pointer_traits<_Fp>::ClassType,
> remove_pointer<A0>>::value
be more accurate? also, wouldn't <Some_Class_C::*Fp, Some_Class_D,
Some_Args...> makes the value of enable_if to be true?
I must guess that there is something I hadn't taken into consideration ;>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140709/bc191284/attachment.html>
More information about the cfe-dev
mailing list