c++ - Using decltype with member function pointers -
i have trouble using decltype member function pointers:
#include <iostream> #include <type_traits> struct { void func1() {} typedef decltype(&a::func1) type; }; int wmain(int argc, wchar_t* argv[]) { typedef decltype(&a::func1) type; //case 1 std::wcout << std::boolalpha << std::is_member_function_pointer<type>::value << std::endl; //case 2 std::wcout << std::boolalpha << std::is_member_function_pointer<a::type>::value << std::endl; system("pause"); return 0; } case 1 prints true expected, case 2 prints false.
is decltype stripping away "member" property of type? if so, why?
also, there way prevent behavior? need type of member function regardless of use decltype.
please help.
edit:
for sake of formality (having answer question), appears bug in vc2010's compiler. file bug report microsoft can fix in next version.
Comments
Post a Comment