Last active
February 27, 2016 18:03
-
-
Save pfultz2/d0eea79bec9f7353339a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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