fork(2) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <type_traits>
  4.  
  5. namespace data
  6. {
  7. struct Foo {};
  8.  
  9. template <typename T>
  10. void func(const std::vector<typename std::enable_if<std::is_pod<T>::value, T>::type>& contents)
  11. {
  12. std::cout << "Blah" << std::endl;
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. std::vector<data::Foo> vec;
  19. func(vec);
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:19:10: error: no matching function for call to 'func(std::vector<data::Foo>&)'
  func(vec);
          ^
prog.cpp:10:7: note: candidate: template<class T> void data::func(const std::vector<typename std::enable_if<std::is_pod<T>::value, T>::type>&)
  void func(const std::vector<typename std::enable_if<std::is_pod<T>::value, T>::type>& contents)
       ^
prog.cpp:10:7: note:   template argument deduction/substitution failed:
prog.cpp:19:10: note:   couldn't deduce template parameter 'T'
  func(vec);
          ^
stdout
Standard output is empty