fork download
  1. #include <cstddef>
  2. #include <utility>
  3. #include <vector>
  4.  
  5. template < class T, class L = size_t >
  6. class Foo{
  7. public:
  8. Foo(std::vector<L> , std::vector<std::vector<T> > );
  9. private:
  10. std::vector<L> shape_;
  11. std::vector<std::vector<T> > cost_;
  12. };
  13.  
  14. template < class T, class L >
  15. Foo<T,L>::Foo( std::vector<L> shape, std::vector< std::vector< T > > ucosts )
  16. :shape_(std::move(shape)), cost_(std::move(ucosts))
  17. {
  18.  
  19. }
  20.  
  21. int main()
  22. {
  23. typedef double termType;
  24. typedef Foo<termType, int> myFoo;
  25. std::vector<int> ushape(10);
  26. std::vector< std::vector< termType> > ucosts(2, std::vector<termType> ( 5, 0 )) ;
  27. myFoo ff1(ushape, ucosts); // <------ DOES NOT WORK
  28. Foo<termType, int> ff2(ushape, ucosts); // <------ DOES WORK
  29. }
Success #stdin #stdout 0s 3424KB
stdin
Standard input is empty
stdout
Standard output is empty