I have to write a simple code that takes a char as input or a string with an integer. Then makes a std vector, depending on the input. If the text says int I have an int vector. The only problem is that I don't want to declare for each variable type a vector even if empty, and I want to make it scalable so if someday I want to put a struct or something else in it i can.
dvec::dvec( char t){
if ( t=='i')
vector<int> a;
else if( t=='f')
vector<float> a;
}
variant
, template everything that uses it or use another scheme to abstract away the concrete type. – François Andrieux Jun 3 '20 at 18:27char t
parameter suggests runtime but I am not sure that is needed. – drescherjm Jun 3 '20 at 18:29