How can I store in a std::vector multiple shared_ptr each one with a pointer to a different type?
std::vector < ? > vec;
vec.push_back( make_shared<int>(3));
vec.push_back( make_shared<float>(3.14f));
Is there a base polymorphic class that can I use for that task without having to use compiler-specific stuff?
There are a few ways you can do this. I assume you want to store various native types, as you're using int and float.
If your list of types is finite, use boost::variant. e.g.
std::vector<std::shared_ptr<boost::variant<int, float>>>;
If you want to store anything, use boost::any. e.g.
std::vector<std::shared_ptr<boost::any>>;