Skip to content

Instantly share code, notes, and snippets.

@pfultz2
Last active February 27, 2016 18:03
Show Gist options
  • Save pfultz2/d0eea79bec9f7353339a to your computer and use it in GitHub Desktop.
Save pfultz2/d0eea79bec9f7353339a to your computer and use it in GitHub Desktop.
template<class Interface>
struct GenericInterface
{
template<class T = Interface>
auto query_interface() const -> decltype(std::declval<T>().interface(), std::string())
{
return i.interface();
}
template<class T = Interface>
auto query_interface() const -> decltype(std::declval<T>().get_my_interface(), std::string())
{
return i.get_my_interface();
}
template<class T = Interface>
auto query_interface() const -> decltype(std::declval<T>().myInterface(), std::string())
{
return i.myInterface();
}
Interface i;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment