Is it possible to assign function parameters directly into a vector holding a structure instead of declaring a local struct variable?
Below is sort of what I'm wanting to do; the following is declared as private data in a class
I've got a member function dataAddItem()
I'm wanting to assign the parameters without having to declare a temporary structure. Is this possible?
TIA
Below is sort of what I'm wanting to do; the following is declared as private data in a class
Code:
typedef struct
{
std::string s1;
std::string s2;
int i1;
int i2;
} item;
std::vector<item> *items;
Code:
bool className::dataAddItem(
const std::string &s1,
const std::string &s2,
const int &i1,
const int &i2)
{
// items->push_back(struct) ??
}
TIA
Comment