how to c++ in a clear manner???
Answers
Answered by
1
A common idiom for clearing standard containers is swapping with an empty version of the container:
void clear( std::queue<int> &q ) { std::queue<int> empty; std::swap( q, empty ); }
It is also the only way of actually clearing the memory held inside some containers (std::vector)
void clear( std::queue<int> &q ) { std::queue<int> empty; std::swap( q, empty ); }
It is also the only way of actually clearing the memory held inside some containers (std::vector)
Similar questions
Hindi,
10 months ago
Chemistry,
10 months ago
Math,
10 months ago
Math,
1 year ago
Computer Science,
1 year ago
India Languages,
1 year ago
India Languages,
1 year ago