Is it possible to initialize a vector with named variables?
Feb 23, 2015 at 2:40pm UTC
Suppose I have individually named variables, and I want to put them in a vector. Just for illustration purposes, say they look like this:
1 2
float height, width, length, area, volume;
vector<float > properties = {height, width, length, area, volume};
Is there a less redundant way to do this, such that I can create a vector or array of named variables without first declaring the variables seperately?
Feb 23, 2015 at 2:49pm UTC
vector of named variables??? not in C++(at least currently). Look up dictionaries(std::map).
Aceix.
Last edited on Feb 23, 2015 at 2:52pm UTC
Topic archived. No new replies allowed.