I’m trying to use is_member_pointer from the type_traits header, with the following syntax, for example:
cout << is_member_pointer<decltype(&vector<int>::member)>::value;
In the case of vectors, I get a “template argument invalid” and a wordy “type of … is unknown” message for all iterator functions and all modifier functions except for clear. There are similar faults for other container functions. I have mingw g++ 4.6.2.
Is there a way to help this?
The problem probably is that you checked the type of overloaded methods. That is not possible, since expressions like
&std::vector<int>::beginhave no type (there are two overloads). It is only after casting to the desired type, that it becomes a member function pointer. The cast would look like this:not very aesthetically pleasing.
With non-overloaded methods, it works.
BTW with gcc-4.7, you even get a clearer error message: