I'm trying to create a boost:tr_vector of a class with a templated member. I'm not sure of the correct way to do this, but what I've tried is below. With this code I get a compiler error which says:
Is there some way to fix my implementation or, if this idea will not work, how would you suggest I do this?Code://GCC 4.3.2 error: type/value mismatch at argument 1 in template parameter list for ‘template<class T, class CloneAllocator, class Allocator> class boost::ptr_vector’ expected a type, got ‘Test’
Thanks for any help
Code:#include <iostream> #include <string> #include <boost/ptr_container/ptr_vector.hpp> using namespace std; template <typename T> class Test { private: T var; public: explicit Test(const T &t) : var(t) {} }; int main() { boost::ptr_vector<Test> vec; vec.push_back(new Test<int>(123)); vec.push_back(new Test<double>(1.23)); vec.push_back(new Test<string>("test")); return 0; }



LinkBack URL
About LinkBacks
tr_vector of a class with a templated member. I'm not sure of the correct way to do this, but what I've tried is below. With this code I get a compiler error which says:



