Many STL algorithms use swap instead of copy constructors
| 2036 | |
| 2037 | // Many STL algorithms use swap instead of copy constructors |
| 2038 | void swap(sparsetable& o) |
| 2039 | { |
| 2040 | using std::swap; |
| 2041 | |
| 2042 | swap(_first_group, o._first_group); |
| 2043 | swap(_last_group, o._last_group); |
| 2044 | swap(_table_size, o._table_size); |
| 2045 | swap(_num_buckets, o._num_buckets); |
| 2046 | if (_alloc != o._alloc) |
| 2047 | swap(_alloc, o._alloc); |
| 2048 | if (_group_alloc != o._group_alloc) |
| 2049 | swap(_group_alloc, o._group_alloc); |
| 2050 | } |
| 2051 | |
| 2052 | // It's always nice to be able to clear a table without deallocating it |
| 2053 | void clear() |
no test coverage detected