/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
struct S {};
template<typename T>
struct A {
T value;
};
template<>
struct A<int> {
typedef bool specialization;
int value;
int another_value;
};
template<>
struct A<S> {
typedef bool specialization;
S value;
};
template<typename T>
struct is_specialization {
typedef char yes[1];
typedef char no[2];
template<class C>
static yes& test(typename C::specialization* = 0);
template<class>
static no& test(...);
enum { value = sizeof(test<T>(0)) == sizeof(yes) };
};
template<typename T>
inline constexpr bool is_specialization_v = is_specialization<T>::value;
int main()
{
std::cout << std::boolalpha;
std::cout << is_specialization_v<A<int>> << std::endl
<< is_specialization_v<A<double>> << std::endl
<< is_specialization_v<A<S>> << std::endl;
}