lundi 5 novembre 2018

does a "pair" which holds object needs to be deleted?

I made a pair like this

typedef std::pair<int, Dish> OrderPair;

when Dish is an object. and I got a vector of OrderPair:

std::vector<OrderPair> orderList;

assuming that I want to delete one pair from the vector, does erase function is enough when I don't want to delete the dish from memory? I think the answer is yes, because creating a pair is not sitting in the heap, and therefore I don't need to release any memory. please tell me if I'm wrong.

Aucun commentaire:

Enregistrer un commentaire