4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::container::tree::object< T > Class Template Reference

Detailed Description

template<typename T>
class fcppt::container::tree::object< T >

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 >)
 
objectoperator= (object const &)
 Deeply assigns a tree.
 
objectoperator= (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.
 

Member Typedef Documentation

◆ child_list

template<typename T >
using fcppt::container::tree::object< T >::child_list = std::list<object>

◆ const_iterator

template<typename T >
using fcppt::container::tree::object< T >::const_iterator = typename child_list::const_iterator

◆ const_optional_ref

template<typename T >
using fcppt::container::tree::object< T >::const_optional_ref = fcppt::optional::reference<object const>

◆ const_reverse_iterator

template<typename T >
using fcppt::container::tree::object< T >::const_reverse_iterator = typename child_list::const_reverse_iterator

◆ difference_type

template<typename T >
using fcppt::container::tree::object< T >::difference_type = typename child_list::difference_type

◆ iterator

template<typename T >
using fcppt::container::tree::object< T >::iterator = typename child_list::iterator

◆ optional_object

template<typename T >
using fcppt::container::tree::object< T >::optional_object = fcppt::optional::object<object>

◆ optional_ref

template<typename T >
using fcppt::container::tree::object< T >::optional_ref = fcppt::optional::reference<object>

◆ reference

template<typename T >
using fcppt::container::tree::object< T >::reference = fcppt::reference<object>

◆ reverse_iterator

template<typename T >
using fcppt::container::tree::object< T >::reverse_iterator = typename child_list::reverse_iterator

◆ size_type

template<typename T >
using fcppt::container::tree::object< T >::size_type = typename child_list::size_type

◆ value_type

template<typename T >
using fcppt::container::tree::object< T >::value_type = T

Constructor & Destructor Documentation

◆ object() [1/5]

template<typename T >
fcppt::container::tree::object< T >::object ( T const & )
explicit

◆ object() [2/5]

template<typename T >
fcppt::container::tree::object< T >::object ( T && )
explicit

◆ object() [3/5]

template<typename T >
fcppt::container::tree::object< T >::object ( T && ,
child_list &&  )

Constructs a tree, including its children, by moving.

◆ object() [4/5]

template<typename T >
fcppt::container::tree::object< T >::object ( object< T > const & )

Deeply copies a tree.

See also
tree_copying

◆ object() [5/5]

template<typename T >
fcppt::container::tree::object< T >::object ( object< T > && ) const
noexcept

◆ ~object()

template<typename T >
fcppt::container::tree::object< T >::~object ( )

Member Function Documentation

◆ back() [1/2]

template<typename T >
optional_ref fcppt::container::tree::object< T >::back ( )
nodiscard

◆ back() [2/2]

template<typename T >
const_optional_ref fcppt::container::tree::object< T >::back ( ) const
nodiscard

◆ begin() [1/2]

template<typename T >
iterator fcppt::container::tree::object< T >::begin ( )
nodiscard

◆ begin() [2/2]

template<typename T >
const_iterator fcppt::container::tree::object< T >::begin ( ) const
nodiscard

◆ children()

template<typename T >
child_list const & fcppt::container::tree::object< T >::children ( ) const
nodiscard

◆ clear()

template<typename T >
void fcppt::container::tree::object< T >::clear ( )

Removes all children.

◆ empty()

template<typename T >
bool fcppt::container::tree::object< T >::empty ( ) const
nodiscard

Returns if the container is empty.

◆ end() [1/2]

template<typename T >
iterator fcppt::container::tree::object< T >::end ( )
nodiscard

◆ end() [2/2]

template<typename T >
const_iterator fcppt::container::tree::object< T >::end ( ) const
nodiscard

◆ erase() [1/2]

template<typename T >
void fcppt::container::tree::object< T >::erase ( iterator )

Erases a single element.

◆ erase() [2/2]

template<typename T >
void fcppt::container::tree::object< T >::erase ( iterator ,
iterator  )

Erases a range.

◆ front() [1/2]

template<typename T >
optional_ref fcppt::container::tree::object< T >::front ( )
nodiscard

◆ front() [2/2]

template<typename T >
const_optional_ref fcppt::container::tree::object< T >::front ( ) const
nodiscard

◆ insert() [1/3]

template<typename T >
void fcppt::container::tree::object< T >::insert ( iterator ,
object< T > &&  )

Inserts an element before the given iterator.

◆ insert() [2/3]

template<typename T >
void fcppt::container::tree::object< T >::insert ( iterator ,
T &&  )

◆ insert() [3/3]

template<typename T >
void fcppt::container::tree::object< T >::insert ( iterator ,
T const &  )

Inserts an element before the given iterator.

◆ operator=() [1/2]

template<typename T >
object & fcppt::container::tree::object< T >::operator= ( object< T > && )
noexcept

◆ operator=() [2/2]

template<typename T >
object & fcppt::container::tree::object< T >::operator= ( object< T > const & )

Deeply assigns a tree.

See also
tree_copying

◆ parent() [1/2]

template<typename T >
optional_ref fcppt::container::tree::object< T >::parent ( )
nodiscard

Returns a reference to the parent of this tree.

◆ parent() [2/2]

template<typename T >
const_optional_ref fcppt::container::tree::object< T >::parent ( ) const
nodiscard

Returns a reference to the parent of this tree.

◆ pop_back()

template<typename T >
optional_object fcppt::container::tree::object< T >::pop_back ( )
nodiscard

Removes a child from the end of the child list.

◆ pop_front()

template<typename T >
optional_object fcppt::container::tree::object< T >::pop_front ( )
nodiscard

Removes a child from the front of the children list and returns it.

◆ push_back() [1/3]

template<typename T >
reference fcppt::container::tree::object< T >::push_back ( object< T > && )

Inserts a new child at the end of the child list.

◆ push_back() [2/3]

template<typename T >
reference fcppt::container::tree::object< T >::push_back ( T && )

◆ push_back() [3/3]

template<typename T >
reference fcppt::container::tree::object< T >::push_back ( T const & )

Inserts a new child at the end of the child list.

◆ push_front() [1/3]

template<typename T >
reference fcppt::container::tree::object< T >::push_front ( object< T > && )

Adds a child in front of the child list.

◆ push_front() [2/3]

template<typename T >
reference fcppt::container::tree::object< T >::push_front ( T && )

◆ push_front() [3/3]

template<typename T >
reference fcppt::container::tree::object< T >::push_front ( T const & )

Adds a child in front of the child list.

◆ rbegin() [1/2]

template<typename T >
reverse_iterator fcppt::container::tree::object< T >::rbegin ( )
nodiscard

◆ rbegin() [2/2]

template<typename T >
const_reverse_iterator fcppt::container::tree::object< T >::rbegin ( ) const
nodiscard

◆ release()

template<typename T >
object fcppt::container::tree::object< T >::release ( iterator )
nodiscard

Detaches the given child from the parent and returns it.

◆ rend() [1/2]

template<typename T >
reverse_iterator fcppt::container::tree::object< T >::rend ( )
nodiscard

◆ rend() [2/2]

template<typename T >
const_reverse_iterator fcppt::container::tree::object< T >::rend ( ) const
nodiscard

◆ size()

template<typename T >
size_type fcppt::container::tree::object< T >::size ( ) const
nodiscard

Returns the number of children.

◆ sort() [1/2]

template<typename T >
void fcppt::container::tree::object< T >::sort ( )

Sorts the children using operator< on T.

◆ sort() [2/2]

template<typename T >
template<typename Predicate >
void fcppt::container::tree::object< T >::sort ( Predicate const & )

Sorts the children using a predicate on two Ts.

◆ swap()

template<typename T >
void fcppt::container::tree::object< T >::swap ( object< T > & )
noexcept

Swaps with another tree.

◆ value() [1/4]

template<typename T >
T & fcppt::container::tree::object< T >::value ( )
nodiscard

Retrieves the tree's value.

◆ value() [2/4]

template<typename T >
T const & fcppt::container::tree::object< T >::value ( ) const
nodiscard

Retrieves the tree's value.

◆ value() [3/4]

template<typename T >
void fcppt::container::tree::object< T >::value ( T && )

◆ value() [4/4]

template<typename T >
void fcppt::container::tree::object< T >::value ( T const & )

Sets a new value.