#include <intrusive_list.h>
Public Member Functions | |
template<typename Iterator > | |
GenericIntrusiveList (Iterator first, Iterator last) | |
GenericIntrusiveList (const GenericIntrusiveList &)=delete | |
GenericIntrusiveList & | operator= (const GenericIntrusiveList &)=delete |
GenericIntrusiveList (GenericIntrusiveList &&other) | |
GenericIntrusiveList & | operator= (GenericIntrusiveList &&other) |
template<typename Iterator > | |
void | assign (Iterator first, Iterator last) |
constexpr Item * | before_begin () noexcept |
Returns a pointer to the sentinel item. | |
constexpr const Item * | before_begin () const noexcept |
constexpr Item * | begin () noexcept |
Returns a pointer to the first item. | |
constexpr const Item * | begin () const noexcept |
Item * | before_end () noexcept |
Returns a pointer to the last item. | |
constexpr Item * | end () noexcept |
Returns a pointer to the sentinel item. | |
constexpr const Item * | end () const noexcept |
bool | empty () const noexcept |
constexpr size_t | max_size () const noexcept |
void | clear () |
Removes all items from the list. | |
void | swap (GenericIntrusiveList< Item > &other) |
template<typename Compare > | |
void | merge (GenericIntrusiveList< Item > &other, Compare comp) |
bool | remove (const Item &item_to_remove) |
template<typename UnaryPredicate > | |
size_t | remove_if (UnaryPredicate pred, size_t max=std::numeric_limits< size_t >::max()) |
void | reverse () |
Reverses the order of items in the list. | |
template<typename BinaryPredicate > | |
size_t | unique (BinaryPredicate pred) |
template<typename Compare > | |
void | sort (Compare comp) |
Static Public Member Functions | |
static Item * | insert_after (Item *prev, Item &item) |
template<typename Iterator > | |
static Item * | insert_after (Item *prev, Iterator first, Iterator last) |
static Item * | erase_after (Item *item) |
static Item * | erase_after (Item *first, Item *last) |
Removes the range of items exclusively between first and last . | |
static void | splice_after (Item *pos, GenericIntrusiveList< Item > &other, Item *first, Item *last) |
Generic intrusive list implementation.
This implementation relies on the Item
type to provide details of how to navigate the list. It provides methods similar to std::forward_list
and std::list
.
Item | The type used to intrusive store list pointers. |
|
inlinestatic |
Removes an item from a list.
The item after the given item
is unlisted, and the item following it is returned.
This is O(1). The item is not destroyed..
|
inlinestatic |
Inserts an item into a list.
The item given by prev
is updated to point to the item as being next in the list, while the item itself points to what prev
previously pointed to as next.
This is O(1). The ownership of the item is not changed.
|
inlinestatic |
Adds items to the list from the provided range after the given item.
This is O(n), where "n" is the number of items in the range.
|
inlineconstexprnoexcept |
Returns how many items can be added.
As an intrusive container, this is effectively unbounded.
|
inline |
Merges the given other
list into this one.
After the call, the list will be sorted according to comp
. The sort is stable, and equivalent items in each list will remain in the same order relative to each other.
|
inline |
Removes any item for which the given unary predicate function p
evaluates to true when passed that item.
UnaryPredicate | Function with the signature bool(const Item&) |
|
inline |
Rearranges the items in the list such that the given comparison function comp
evaluates to true for each pair of successive items.
BinaryPredicate | Function with the signature bool(const Item&, const Item&) |
|
inlinestatic |
Moves the items exclusively between first
and last
from other
to after pos
in this list.
|
inline |
Removes consecutive ietms that are equivalent accroding to the given binary predicate p
, leaving only the first item in the list.
BinaryPredicate | Function with the signature bool(const Item&, const Item&) |