Clears all data, without resizing.
| 1680 | |
| 1681 | // Clears all data, without resizing. |
| 1682 | void clear() { |
| 1683 | ROBIN_HOOD_TRACE(this) |
| 1684 | if (empty()) { |
| 1685 | // don't do anything! also important because we don't want to write to |
| 1686 | // DummyInfoByte::b, even though we would just write 0 to it. |
| 1687 | return; |
| 1688 | } |
| 1689 | |
| 1690 | Destroyer<Self, IsFlat && std::is_trivially_destructible<Node>::value>{}.nodes(*this); |
| 1691 | |
| 1692 | auto const numElementsWithBuffer = calcNumElementsWithBuffer(mMask + 1); |
| 1693 | // clear everything, then set the sentinel again |
| 1694 | uint8_t const z = 0; |
| 1695 | std::fill(mInfo, mInfo + calcNumBytesInfo(numElementsWithBuffer), z); |
| 1696 | mInfo[numElementsWithBuffer] = 1; |
| 1697 | |
| 1698 | mInfoInc = InitialInfoInc; |
| 1699 | mInfoHashShift = InitialInfoHashShift; |
| 1700 | } |
| 1701 | |
| 1702 | // Destroys the map and all it's contents. |
| 1703 | ~Table() { |