2.10.0
Freundlich's C++ toolkit
Public Types | Public Member Functions
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

typedef std::list< objectchild_list
 
typedef T value_type
 
typedef child_list::size_type size_type
 
typedef child_list::difference_type difference_type
 
typedef child_list::iterator iterator
 
typedef child_list::const_iterator const_iterator
 
typedef child_list::reverse_iterator reverse_iterator
 
typedef child_list::const_reverse_iterator const_reverse_iterator
 
typedef fcppt::optional::reference< objectoptional_ref
 
typedef fcppt::optional::reference< object const > const_optional_ref
 
typedef fcppt::optional::object< objectoptional_object
 
typedef fcppt::reference< objectreference
 

Public Member Functions

 object (T const &)
 Constructs the object using the given value. More...
 
 object (T &&)
 
 object (T &&, child_list &&)
 Constructs a tree, including its children, by moving. More...
 
 object (object const &)
 Deeply copies a tree. More...
 
 object (object &&) noexcept(std::is_nothrow_move_constructible< T >::value)
 
objectoperator= (object const &)
 Deeply assigns a tree. More...
 
objectoperator= (object &&) noexcept(std::is_nothrow_move_assignable< T >::value)
 
 ~object ()
 
child_list const & children () const
 
optional_ref parent ()
 Returns a reference to the parent of this tree. More...
 
const_optional_ref parent () const
 Returns a reference to the parent of this tree. More...
 
object release (iterator)
 Detaches the given child from the parent and returns it. More...
 
void value (T const &)
 Sets a new value. More...
 
void value (T &&)
 
T & value ()
 Retrieves the tree's value. More...
 
T const & value () const
 Retrieves the tree's value. More...
 
reference push_back (object &&)
 Inserts a new child at the end of the child list. More...
 
reference push_back (T const &)
 Inserts a new child at the end of the child list. More...
 
reference push_back (T &&)
 
optional_object pop_back ()
 Removes a child from the end of the child list. More...
 
reference push_front (object &&)
 Adds a child in front of the child list. More...
 
reference push_front (T const &)
 Adds a child in front of the child list. More...
 
reference push_front (T &&)
 
optional_object pop_front ()
 Removes a child from the front of the children list and returns it. More...
 
void clear ()
 Removes all children. More...
 
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. More...
 
void insert (iterator, T const &)
 Inserts an element before the given iterator. More...
 
void insert (iterator, T &&)
 
void erase (iterator)
 Erases a single element. More...
 
void erase (iterator, iterator)
 Erases a range. More...
 
size_type size () const
 Returns the number of children. More...
 
bool empty () const
 Returns if the container is empty. More...
 
void swap (object &)
 Swaps with another tree. More...
 
void sort ()
 Sorts the children using operator< on T. More...
 
template<typename Predicate >
void sort (Predicate const &)
 Sorts the children using a predicate on two Ts. More...
 

Member Typedef Documentation

◆ child_list

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

◆ const_iterator

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

◆ const_optional_ref

◆ const_reverse_iterator

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

◆ difference_type

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

◆ iterator

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

◆ optional_object

◆ optional_ref

◆ reference

template<typename T>
typedef fcppt::reference< object > fcppt::container::tree::object< T >::reference

◆ reverse_iterator

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

◆ size_type

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

◆ value_type

template<typename T>
typedef T fcppt::container::tree::object< T >::value_type

Constructor & Destructor Documentation

◆ object() [1/5]

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

Constructs the object using the given value.

◆ 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 ( )

◆ back() [2/2]

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

◆ begin() [1/2]

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

◆ begin() [2/2]

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

◆ children()

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

◆ 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

Returns if the container is empty.

◆ end() [1/2]

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

◆ end() [2/2]

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

◆ 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 ( )

◆ front() [2/2]

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

◆ 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 const &   
)

Inserts an element before the given iterator.

◆ insert() [3/3]

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

◆ operator=() [1/2]

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

Deeply assigns a tree.

See also
tree_copying

◆ operator=() [2/2]

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

◆ parent() [1/2]

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

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

Returns a reference to the parent of this tree.

◆ pop_back()

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

Removes a child from the end of the child list.

◆ pop_front()

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

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 const &  )

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

◆ push_back() [3/3]

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

◆ 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 const &  )

Adds a child in front of the child list.

◆ push_front() [3/3]

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

◆ rbegin() [1/2]

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

◆ rbegin() [2/2]

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

◆ release()

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

Detaches the given child from the parent and returns it.

◆ rend() [1/2]

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

◆ rend() [2/2]

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

◆ size()

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

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 > &  )

Swaps with another tree.

◆ value() [1/4]

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

Sets a new value.

◆ value() [2/4]

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

◆ value() [3/4]

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

Retrieves the tree's value.

◆ value() [4/4]

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

Retrieves the tree's value.