ext::MoveEraser
Erase policy based on moving the last element to the erased element.
#include <linear_map.h>
Public Functions
| Name | |
|---|---|
| template <class T > <br>T::iterator | erase(typename T::iterator it, T * container)<br>Moves the last element into the to-be-erased element. |
| template <class T > <br>T::iterator | erase(typename T::const_iterator it, T * container) |
Public Functions Documentation
function erase
cpp
template <class T >
static inline T::iterator erase(
typename T::iterator it,
T * container
)Moves the last element into the to-be-erased element.
Parameters:
- it The iterator pointing to the element.
- container The host container.
Template Parameters:
- T The container type.
Return: The iterator pointing to the original position.
Warning: The order of elements is changed after this erase.
Then, the last element is popped back. This is an efficient, constant time operation for contiguous containers.
function erase
cpp
template <class T >
static inline T::iterator erase(
typename T::const_iterator it,
T * container
)Updated on 2026-01-09 at 21:59:12 +0000
