c++11 - C++ casting a std::vector<Derived>* to std::vector<Base> ...? -


i'm making vector of pointers vectors:

    std::vector<std::vector<base>*> all; // vector keeping pointers vectors 

and problem have several vectors of derived classes:

    std::vector<derived1> derived1; // vector of derived class     std::vector<derived2> derived2; // vector of derived class     std::vector<derived3> derived2; // vector of derived class 

is there safe way change type of pointer vector<derivedx> vector<base>?

every derived class shares behavior , alive of program's life.

i'm still not @ explaining programming problems, should questions concerning details arise - please ask in comments.

no, not possible. there no relationship between std::vector<base> , std::vector<derived>.

in other words: std::vector<derived> not derived std::vector<base>.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -

Why does a .NET 4.0 program produce a system.unauthorizedAccess error on a Windows Server 2012 machine with .NET 4.5 installed? -