use shrink_to_fit() instead of swap trick
This commit is contained in:
parent
1d3932e8c5
commit
08eb5aa7d1
@ -41,7 +41,7 @@ template <typename T> inline void sort_unique_resize(std::vector<T> &vector)
|
|||||||
template <typename T> inline void sort_unique_resize_shrink_vector(std::vector<T> &vector)
|
template <typename T> inline void sort_unique_resize_shrink_vector(std::vector<T> &vector)
|
||||||
{
|
{
|
||||||
sort_unique_resize(vector);
|
sort_unique_resize(vector);
|
||||||
std::vector<T>().swap(vector);
|
vector.shrink_to_fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> inline void remove_consecutive_duplicates_from_vector(std::vector<T> &vector)
|
template <typename T> inline void remove_consecutive_duplicates_from_vector(std::vector<T> &vector)
|
||||||
|
Loading…
Reference in New Issue
Block a user