Skip to content

Instantly share code, notes, and snippets.

@erincandescent
Created February 24, 2013 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erincandescent/5025486 to your computer and use it in GitHub Desktop.
Save erincandescent/5025486 to your computer and use it in GitHub Desktop.
template<typename T, T V>
class get_member;
template<typename Class, typename T, T Class::* Pointer>
class get_member<T Class::*, Pointer>
{
public:
inline T& operator()(Class& c)
{
return c.*Pointer;
}
inline const T& operator()(const Class& c)
{
return c.*Pointer;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment