C
clqrq
i want to do the following....
1) fill a struct (lets call it Data)
2) push it to a vector of Data
3) get a pointer to pushed vector-element.
std::vector<Data> vData;
(lets assume we now filled some elements into the vector, erased some,
and now do the following...)
Data x = /* something */ y;
vData.push_back(x);
my question is:
is there a more simplier way to get a pointer to the new vector-element
than
Data* pData = &vData[vData.size() - 1];
and IS it the correct pointer? does push always add to the end?
thx for any knowlege ;-)
1) fill a struct (lets call it Data)
2) push it to a vector of Data
3) get a pointer to pushed vector-element.
std::vector<Data> vData;
(lets assume we now filled some elements into the vector, erased some,
and now do the following...)
Data x = /* something */ y;
vData.push_back(x);
my question is:
is there a more simplier way to get a pointer to the new vector-element
than
Data* pData = &vData[vData.size() - 1];
and IS it the correct pointer? does push always add to the end?
thx for any knowlege ;-)