fork download
  1. #include <vector>
  2. #include <memory>
  3.  
  4. template<class T>
  5. std::vector<T> make_vector(){
  6. std::vector<T> v;
  7. // ...
  8. return v;
  9. }
  10.  
  11. template<class T, class Alloc>
  12. std::vector<T, Alloc> make_vector(Alloc const& al = Alloc()){
  13. std::vector<T, Alloc> v(al);
  14. // ...
  15. return v;
  16. }
  17.  
  18. int main(){
  19. auto v1 = make_vector<int>();
  20. auto v2 = make_vector<int, std::allocator<int>>();
  21. std::allocator<int> al;
  22. auto v3 = make_vector<int, std::allocator<int>>(al);
  23. }
Success #stdin #stdout 0s 2824KB
stdin
Standard input is empty
stdout
Standard output is empty