fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. template<class T>
  7. struct is_container
  8. {
  9. static const bool value = false;
  10. };
  11.  
  12. template<>
  13. template<class T, class Alloc>
  14. struct is_container<std::vector<T, Alloc>>
  15. {
  16. static const bool value = true;
  17. };
  18.  
  19. // ... same specializations for other containers...
  20.  
  21. int main() {
  22. cout << is_container<std::vector<int>>::value << endl;
  23. cout << is_container<int>::value << endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1
0