I'm just curious - is there a reason why "member" takes 3 template parameters, and not just one, like in
member<&Peer::userid>
? The first two types can be extracted from the member pointer, so I find this a bit redundant...
It certainly looks redundant, but it turns out you really cannot do what you propose:
template<...> struct member;
What should "..." look like? It's not a type parameter, but it cannot be made a non-type parameter either since we don't know the type of the pointer-to-member being passed...
In decltype- (or typeof-) enabled compilers a terser syntax could be achieved by using some macro hackery:
template
struct member; #define MEMBER(PtrToMember) \ member
So maybe when C++0x arrives we can take advantage of this.
I use this template in my code:
template<typename T>
struct get_pointer_to_member_details;
template