std::list::push_back, and push_back for any other STL container, uses a const reference.
void push_back ( const T& x );
Add element at the end
Adds a new element at the end of the list, right after its current last element. The content of this new element is initialized to a copy of x.
This effectively increases the list size by one.Incidentally, this (unasked) question is better than the earlier one. Most of the time, you just need to explain the real, actual problem, and delve not into hypotheticals. There are so many smart people here, it is unfair to other places.Code:while ( whatever ) { Dog save(stuff); a.push_back(save); }



LinkBack URL
About LinkBacks




ush_back, and push_back for any other STL container, uses a const reference.
