c++ - How to Make a vector of template structs -


possible duplicate:
c++ template problem

hi everyone:

i'm stuck trying following:

template <typename t>   struct test {   t* value;   test(int num_of_elements) { value = new t[num_of_elements] };   }    std::vector<test *> fields_; 

i.e. want make vector of pointers set of test structs different types value?

how do this?

thanks

ross

you use boost::any. example documentation illustrates use case (at least, you've described far):

struct property {     property();     property(const std::string &, const boost::any &);      std::string name;     boost::any value; };  typedef std::list<property> properties; 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -