Obtain original struct/class name during C++ template instantiation

Viewed 290
template<typename T> struct S {};
template<typename T> struct R {};

int main() {
  typedef S<double> s1;
  typedef S<int> s2;
  typedef R<int> s3;
  static_assert(xxx<s1, s2>::value,
                "No, assertion must not be raised");
  static_assert(xxx<s2, s3>::value,
                "Yes, assertion must be raised");
}

So, I want xxx<s1, s2>::value to return true while xxx<s2, s3>::value to return false during compile-time.

Is the existence of xxx impossible in C++? Or, is the existence of xxx theoretically possible in C++ but possibly no one has done it yet?

2 Answers
Related