Skip to content

Instantly share code, notes, and snippets.

@ledif
Created February 5, 2016 21:50
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 ledif/a70b13ba7a0af16d3f7c to your computer and use it in GitHub Desktop.
Save ledif/a70b13ba7a0af16d3f7c to your computer and use it in GitHub Desktop.
#include <iostream>
#include <type_traits>
template<int A, typename B, typename C>
struct X { };
template<typename T>
struct is_X : std::false_type {};
template<typename... Args>
struct is_X<X<Args...>> : std::true_type {};
int main(int argc, char* argv[]) {
using my_x = X<0, float, char>;
std::cout << is_X<my_x>::value << std::endl;
return 0;
}
@ipapadop
Copy link

ipapadop commented Feb 5, 2016

include

include <type_traits>

template<int A, typename B, typename C>
struct X { };

template
struct is_X : std::false_type {};

template<int I, typename... Args>
struct is_X<X<I, Args...>> : std::true_type {};

int main(int argc, char* argv[]) {
using my_x = X<0, float, char>;

std::cout << is_X<my_x>::value << std::endl;

return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment