c++ - Pointer to two different types of vectors -


is possible create pointer either points vector<char> or vector<foo>? depends on data handled. if says chars or need foo. foo class.

there ways safely. example, can use boost::any or similar tool. not pointer, assume, not need single pointer, need object can 1 thing or depending on circumstance.

while dislike idea of variable can anything, know people find useful.

edit

as correctly noted in comments, judging question, boost::variant might better suited - everywhere when possible types held known in advance. perform faster.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -