cptr::detail::basic_list

The class behind cptr::list; use that alias. Its members behave like those of std::list; the alias lists the differences.

Synopsis

Declared in <cptr/list.hpp>

template<
    class T,
    class Cage,
    bool Compressed>
class basic_list;

Description

The list behind cptr::list. Compressed = false gives the same list with raw 8-byte links, which the benchmarks compare against.

It is circular around a sentinel node that holds only the two links. The sentinel lives in the cage, so it can be linked to with compressed pointers, and the list object itself can live anywhere. Iterators are a single node pointer, and end() stays valid while the list exists.

Types

Name
basic_iterator

Type Aliases

Name
const_iterator
const_reference
const_reverse_iterator
difference_type
iterator
reference
reverse_iterator
size_type
value_type

Member Functions

NameDescription
basic_list [constructor]Constructors
~basic_list [destructor]Destructor
operator= Assignment operators
assign
back
begin
cbegin
cend
clear
crbegin
crend
emplace Construct an element from args before pos. Like std, it direct-initialises the element, so only the conversions std accepts compile.
emplace_back
emplace_front
empty
end
erase
front
insert
max_size
merge Merge sorted other into this sorted list. Stable: of equal elements, this list's come first. If comp throws, the elements moved so far stay here, the rest stay in other, both sizes are right, and the exception propagates.
pop_back
pop_front
push_back
push_front
rbegin
remove Erase the elements equal to value and return how many. Unlinked nodes are destroyed only at the end, so value may refer to an element of this list. If a comparison throws, the elements already found are erased, the rest are kept, and the exception propagates.
remove_if Erase the elements for which pred is true and return how many. If pred throws, the elements already found are erased, the rest are kept, and the exception propagates.
rend
resize
reverse
size
sort Stable merge sort on the links; no element is copied or moved. If comp throws, the list keeps all its elements in an unspecified order and the exception propagates.
splice splice overloads
swap
unique Erase all but the first of each run of consecutive elements for which pred is true, and return how many were erased. If pred throws, the elements already found are erased and the exception propagates.

Static Data Members

NameDescription
node_size Bytes per element, including the links: what the cage hands out.

Friends

NameDescription
cptr::detail::operator<=>Lexicographical, with std's synth-three-way: elements that have only operator< give a std::weak_ordering.
cptr::detail::operator==Equality operator
cptr::detail::swap