4.6.0
Freundlich's C++ toolkit
|
A tree data structure.
Public Types | |
using | child_list = std::list<object> |
using | value_type = T |
using | size_type = typename child_list::size_type |
using | difference_type = typename child_list::difference_type |
using | iterator = typename child_list::iterator |
using | const_iterator = typename child_list::const_iterator |
using | reverse_iterator = typename child_list::reverse_iterator |
using | const_reverse_iterator = typename child_list::const_reverse_iterator |
using | optional_ref = fcppt::optional::reference<object> |
using | const_optional_ref = fcppt::optional::reference<object const> |
using | optional_object = fcppt::optional::object<object> |
using | reference = fcppt::reference<object> |
Public Member Functions | |
object (T const &) | |
object (T &&) | |
object (T &&, child_list &&) | |
Constructs a tree, including its children, by moving. | |
object (object const &) | |
Deeply copies a tree. | |
object (object &&) noexcept(std::is_nothrow_move_constructible_v< T >) | |
object & | operator= (object const &) |
Deeply assigns a tree. | |
object & | operator= (object &&) noexcept(std::is_nothrow_move_assignable_v< T >) |
~object () | |
child_list const & | children () const |
optional_ref | parent () |
Returns a reference to the parent of this tree. | |
const_optional_ref | parent () const |
Returns a reference to the parent of this tree. | |
object | release (iterator) |
Detaches the given child from the parent and returns it. | |
void | value (T const &) |
Sets a new value. | |
void | value (T &&) |
T & | value () |
Retrieves the tree's value. | |
T const & | value () const |
Retrieves the tree's value. | |
reference | push_back (object &&) |
Inserts a new child at the end of the child list. | |
reference | push_back (T const &) |
Inserts a new child at the end of the child list. | |
reference | push_back (T &&) |
optional_object | pop_back () |
Removes a child from the end of the child list. | |
reference | push_front (object &&) |
Adds a child in front of the child list. | |
reference | push_front (T const &) |
Adds a child in front of the child list. | |
reference | push_front (T &&) |
optional_object | pop_front () |
Removes a child from the front of the children list and returns it. | |
void | clear () |
Removes all children. | |
optional_ref | back () |
const_optional_ref | back () const |
optional_ref | front () |
const_optional_ref | front () const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
reverse_iterator | rbegin () |
reverse_iterator | rend () |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
void | insert (iterator, object &&) |
Inserts an element before the given iterator. | |
void | insert (iterator, T const &) |
Inserts an element before the given iterator. | |
void | insert (iterator, T &&) |
void | erase (iterator) |
Erases a single element. | |
void | erase (iterator, iterator) |
Erases a range. | |
size_type | size () const |
Returns the number of children. | |
bool | empty () const |
Returns if the container is empty. | |
void | swap (object &) noexcept |
Swaps with another tree. | |
void | sort () |
Sorts the children using operator< on T. | |
template<typename Predicate > | |
void | sort (Predicate const &) |
Sorts the children using a predicate on two Ts. | |
using fcppt::container::tree::object< T >::child_list = std::list<object> |
using fcppt::container::tree::object< T >::const_iterator = typename child_list::const_iterator |
using fcppt::container::tree::object< T >::const_optional_ref = fcppt::optional::reference<object const> |
using fcppt::container::tree::object< T >::const_reverse_iterator = typename child_list::const_reverse_iterator |
using fcppt::container::tree::object< T >::difference_type = typename child_list::difference_type |
using fcppt::container::tree::object< T >::iterator = typename child_list::iterator |
using fcppt::container::tree::object< T >::optional_object = fcppt::optional::object<object> |
using fcppt::container::tree::object< T >::optional_ref = fcppt::optional::reference<object> |
using fcppt::container::tree::object< T >::reference = fcppt::reference<object> |
using fcppt::container::tree::object< T >::reverse_iterator = typename child_list::reverse_iterator |
using fcppt::container::tree::object< T >::size_type = typename child_list::size_type |
using fcppt::container::tree::object< T >::value_type = T |
|
explicit |
|
explicit |
fcppt::container::tree::object< T >::object | ( | T && | , |
child_list && | ) |
Constructs a tree, including its children, by moving.
fcppt::container::tree::object< T >::object | ( | object< T > const & | ) |
Deeply copies a tree.
|
noexcept |
fcppt::container::tree::object< T >::~object | ( | ) |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |
void fcppt::container::tree::object< T >::clear | ( | ) |
Removes all children.
|
nodiscard |
Returns if the container is empty.
|
nodiscard |
|
nodiscard |
void fcppt::container::tree::object< T >::erase | ( | iterator | ) |
Erases a single element.
void fcppt::container::tree::object< T >::erase | ( | iterator | , |
iterator | ) |
Erases a range.
|
nodiscard |
|
nodiscard |
void fcppt::container::tree::object< T >::insert | ( | iterator | , |
object< T > && | ) |
Inserts an element before the given iterator.
void fcppt::container::tree::object< T >::insert | ( | iterator | , |
T && | ) |
void fcppt::container::tree::object< T >::insert | ( | iterator | , |
T const & | ) |
Inserts an element before the given iterator.
|
noexcept |
object & fcppt::container::tree::object< T >::operator= | ( | object< T > const & | ) |
Deeply assigns a tree.
|
nodiscard |
Returns a reference to the parent of this tree.
|
nodiscard |
Returns a reference to the parent of this tree.
|
nodiscard |
Removes a child from the end of the child list.
|
nodiscard |
Removes a child from the front of the children list and returns it.
reference fcppt::container::tree::object< T >::push_back | ( | object< T > && | ) |
Inserts a new child at the end of the child list.
reference fcppt::container::tree::object< T >::push_back | ( | T && | ) |
reference fcppt::container::tree::object< T >::push_back | ( | T const & | ) |
Inserts a new child at the end of the child list.
reference fcppt::container::tree::object< T >::push_front | ( | object< T > && | ) |
Adds a child in front of the child list.
reference fcppt::container::tree::object< T >::push_front | ( | T && | ) |
reference fcppt::container::tree::object< T >::push_front | ( | T const & | ) |
Adds a child in front of the child list.
|
nodiscard |
|
nodiscard |
|
nodiscard |
Detaches the given child from the parent and returns it.
|
nodiscard |
|
nodiscard |
|
nodiscard |
Returns the number of children.
void fcppt::container::tree::object< T >::sort | ( | ) |
Sorts the children using operator< on T.
void fcppt::container::tree::object< T >::sort | ( | Predicate const & | ) |
Sorts the children using a predicate on two Ts.
|
noexcept |
Swaps with another tree.
|
nodiscard |
Retrieves the tree's value.
|
nodiscard |
Retrieves the tree's value.
void fcppt::container::tree::object< T >::value | ( | T && | ) |
void fcppt::container::tree::object< T >::value | ( | T const & | ) |
Sets a new value.