fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4.  
  5. template <class T>
  6. void foo(const T& t)
  7. {
  8. std::cout << t.size() << std::endl;
  9. }
  10.  
  11.  
  12. int main()
  13. {
  14. std::vector<int> v = { 1, 2, 3 };
  15. foo(v);
  16. foo(std::map<int,int>{});
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 4536KB
stdin
Standard input is empty
stdout
3
0