Although I'm not 100% sure, I correctly understand the question, if there is some kind of mapping from the member pointer to some unique identifier, the following code can fulfill the goal:
struct A { void f() {} void g( int ) {} }; template< class T, T > char* get_unique_id() { static char dummy; return &dummy; } int main() { set< char* > s; s.insert( get_unique_id< decltype( &A::f ), &A::f >() ); s.insert( get_unique_id< decltype( &A::g ), &A::g >() ); s.insert( get_unique_id< decltype( &A::f ), &A::f >() ); s.insert( get_unique_id< decltype( &A::g ), &A::g >() ); cout<< s.size() <<endl;
The call to get_unique_id bit long, though ... Presumably some macros may help make this easier.
Hope this helps
Isse wisteria
source share