fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class, class=void> struct is_complete : std::false_type {};
  5. template <class T>
  6. struct is_complete<T, decltype(void(sizeof(T)))> : std::true_type {};
  7.  
  8. struct A;
  9. struct Foo {};
  10. int main() {
  11.  
  12. is_complete<Foo>::value;
  13. static_assert(is_complete<Foo>::value, "Type is not defined!");
  14.  
  15. is_complete<A>::value;
  16. static_assert(is_complete<A>::value, "Type is not defined!");
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:16:5: error: static assertion failed: Type is not defined!
     static_assert(is_complete<A>::value, "Type is not defined!");
     ^
stdout
Standard output is empty