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. void a() {
  13. struct q;
  14. std::cout << is_complete< q >::value << '\n';
  15. struct q {};
  16. std::cout << is_complete< q >::value << '\n';
  17. }
  18.  
  19.  
  20. int main() {
  21. std::cout.setf( std::ios::boolalpha );
  22. a();
  23. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
false
true