J
Jorgen Grahn
std::foo<bar> *a = ...;
std::foo<bar> *b = ...;
You don't have to swap the contents, you can swap pointers to the
containers:
std::swap(a, b); // O(1)
Regarding swapping actual containers or references to containers, you
might get lucky and the swap is optimized for the containers,
"Might get lucky" is too pessimistic. All standard containers I know of
have a fast, non-throwing swap. "ittium" should read the
documentation for whatever container he or she is using.
/Jorgen