fork download
  1. #include <iostream>
  2.  
  3. template< typename t >
  4. typename std::enable_if< sizeof (t), std::true_type >::type
  5. is_complete_fn( t * );
  6.  
  7. std::false_type is_complete_fn( ... );
  8.  
  9. template< typename t, bool value = decltype( is_complete_fn( (t *) nullptr ) )::value >
  10. struct is_complete : std::integral_constant< bool, value > {};
  11.  
  12. struct q;
  13.  
  14. void a() {
  15. std::cout << is_complete< q >::value << '\n';
  16. }
  17.  
  18. struct q {};
  19.  
  20. void b() {
  21. std::cout << is_complete< q >::value << '\n';
  22. }
  23.  
  24. int main() {
  25. std::cout.setf( std::ios::boolalpha );
  26. a();
  27. b();
  28. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
false
true