The expression vector<Contestant>(contestants) creates a temporary vector that is a
copy of contestants: vector's copy constructor does the work.
......
At that point (the end of the statement), the temporary
vector is destroyed, thus freeing the memory formerly used by contestants. Voila! Shrink-to-fit.
so my question is how do i know(or guarantee) the temporary vector is freed, is there any sign of it, or it is freed just because it is a anonymous vector with no explicit variable referring to it.
Plus,statements like this is fuzzy to me ,kind of resource-leaky.