I'm trying to add two values into a vector of a custom type, without creating a variable of that type.
typedef struct duo{
int uniqueID;
double data;
};
vector<duo> myVector;
myVector.push_back({1,1.0});
But it won't allow it??
The only way I can get it to work is if I create the variable, but feels tedious...
vector<duo> myVector;
duo temp = {1,1.0};
myVector.push_back(temp);
Also... why can't I do this?
duo temp;
temp = {1,1.0};
but I can do this:
duo temp = {1,1.0};
???