fork download
  1. #include <vector>
  2. #include <list>
  3. #include <cstdio>
  4.  
  5. template<typename T>
  6. struct template_struct;
  7.  
  8. template<typename T>
  9. struct template_struct<std::vector<T>> {
  10. static void exec() {
  11. printf("std::vector specialization\n");
  12. }
  13. };
  14.  
  15. template<typename T>
  16. struct template_struct<std::list<T>> {
  17. static void exec() {
  18. printf("std::list specialization\n");
  19. }
  20. };
  21.  
  22. int main() {
  23. std::vector<int> x;
  24. std::list<float> y;
  25. template_struct<decltype(x)>::exec();
  26. template_struct<decltype(y)>::exec();
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
std::vector specialization
std::list specialization