Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#ifndef GENERS_IOISCLASSTYPE_HH_
#define GENERS_IOISCLASSTYPE_HH_

namespace gs {
  template <typename T>
  class IOIsClassType {
    typedef char One;
    typedef struct {
      char a[2];
    } Two;
    template <typename C>
    static One test(int C::*);
    template <typename C>
    static Two test(...);

  public:
    enum { value = sizeof(IOIsClassType<T>::template test<T>(nullptr)) == 1 };
  };
}  // namespace gs

#endif  // GENERS_IOISCLASSTYPE_HH_