Created
February 1, 2018 14:20
-
-
Save geneotech/a48a977540d95c3d1db765e639de9720 to your computer and use it in GitHub Desktop.
This file contains 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
#include <type_traits> | |
#include <iostream> | |
template <class A, class = void> | |
struct has_member : std::false_type {}; | |
template <class A> | |
struct has_member<A, decltype(A::member, void())> : std::true_type {}; | |
struct AA { static constexpr bool member = true; }; | |
struct BB {}; | |
int main() { | |
std::cout << has_member<AA>::value << std::endl; | |
std::cout << has_member<BB>::value << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment