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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -