|
0.12.0
|
|
Freundlich's C++ toolkit |
A tree data structure.
See the documentation of fcppt::container::tree::object to know more.
Public Types | |
| typedef boost::ptr_list< object > | child_list |
| typedef fcppt::unique_ptr< object > | unique_ptr |
| typedef T | value_type |
| typedef child_list::size_type | size_type |
| typedef child_list::difference_type | difference_type |
| typedef child_list::reference | reference |
| typedef child_list::const_reference | const_reference |
| 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 tree::is_ptr_value< T > | is_ptr_tree |
| typedef boost::mpl::eval_if < is_ptr_tree, fcppt::mpl::inner< T > , boost::mpl::identity< T > >::type | stored_type |
The type to store, possibly extracted from ptr_value<T> | |
| typedef boost::mpl::if_ < is_ptr_tree, fcppt::unique_ptr< stored_type > , stored_type >::type | arg_base_type |
The type to forward to other functions (either T or unique_ptr<T>) | |
| typedef boost::mpl::if_ < is_ptr_tree, arg_base_type, arg_base_type const & >::type | arg_type |
The type to pass to other functions (either T const & or unique_ptr<T>) | |
| typedef boost::mpl::if_ < is_ptr_tree, fcppt::scoped_ptr< stored_type > , stored_type >::type | holder_type |
The type that holds the stored type (either T or scoped_ptr<T>) | |
Public Member Functions | |
| object () | |
| Constructs the tree using the default constructed value. | |
| object (arg_type) | |
| Constructs the object using the given value. | |
| object (object const &) | |
| Deeply copies a tree. | |
| object & | operator= (object const &) |
| Deeply assigns a tree. | |
| ~object () | |
| child_list & | children () |
| child_list const & | children () const |
| object & | parent () |
| Returns a reference to the parent of this tree. | |
| object const & | parent () const |
| Returns a reference to the parent of this tree. | |
| object * | parent_ptr () |
| Returns a pointer to the parent of this tree. | |
| object const * | parent_ptr () const |
| Returns a pointer to the parent of this tree. | |
| bool | has_parent () const |
| Returns if this tree has a parent. | |
| void | parent (object &) |
| Sets a new parent. | |
| unique_ptr | release (iterator) |
| Detaches the given child from the parent and returns it. | |
| iterator | child_position () |
| Returns an iterator pointing to the position in the parent's child container where this object resides. | |
| const_iterator | child_position () const |
| Returns an iterator pointing to the position in the parent's child container where this object resides. | |
| void | value (arg_type) |
| Sets a new value. | |
| stored_type & | value () |
| Retrieves the tree's value. | |
| stored_type const & | value () const |
| Retrieves the tree's value. | |
| bool | has_value () const |
| Returns if this node holds a value Will always be true for normal trees. If the tree holds a ptr_value it depends on whether it has been initialized. | |
| holder_type & | holder () |
| Returns a reference to the holder type. | |
| holder_type const & | holder () const |
| Returns a const reference to the holder type. | |
| void | push_back (unique_ptr) |
| Inserts a new child at the end of the child list. | |
| void | push_back (arg_type) |
| Inserts a new child at the end of the child list. | |
| void | pop_back () |
| Removes a child from the end of the child list. | |
| void | push_front (unique_ptr) |
| Adds a child in front of the child list. | |
| void | push_front (arg_type) |
| Adds a child in front of the child list. | |
| void | pop_front () |
| Removes a child from the front of the child list. | |
| void | clear () |
| Removes all children. | |
| reference | back () |
| Returns a reference to the last child. | |
| const_reference | back () const |
| Returns a reference to the last child. | |
| reference | front () |
| Returns a reference to the first child. | |
| const_reference | front () const |
| Returns a reference to the first child. | |
| iterator | begin () |
| Returns an iterator to the first child (if present) | |
| iterator | end () |
| Returns an iterator to "one past the last child", if present, otherwise returns begin . | |
| const_iterator | begin () const |
| Returns an iterator to the first child (if present) | |
| const_iterator | end () const |
| Returns an iterator to "one past the last child", if present, otherwise returns begin . | |
| reverse_iterator | rbegin () |
| Returns a reverse_iterator to the last element (if present) | |
| reverse_iterator | rend () |
| Returns a reverse_iterator to the first element (if present) | |
| const_reverse_iterator | rbegin () const |
| Returns a const_reverse_iterator to the last element (if present) | |
| const_reverse_iterator | rend () const |
| Returns a const_reverse_iterator to the first element (if present) | |
| const_iterator | cbegin () const |
| Returns a const_iterator to the first child (if present) | |
| const_iterator | cend () const |
| Returns a const_iterator to the first child (if present) | |
| const_reverse_iterator | crbegin () const |
| Returns a const_reverse_iterator to the last element (if present) | |
| const_reverse_iterator | crend () const |
| Returns a const_reverse_iterator to the first element (if present) | |
| void | insert (iterator, unique_ptr) |
| Inserts an element before the given iterator. | |
| void | insert (iterator, arg_type) |
| Inserts an element before the given iterator. | |
| void | erase (iterator) |
| Erases a single element. | |
| void | erase (iterator, iterator) |
| Erases a range. | |
| size_type | size () const |
| Returns the number of children. | |
| size_type | max_size () const |
| Returns the ptr_list's max_size. | |
| bool | empty () const |
| Returns if the container is empty. | |
| void | swap (object &) |
| Swaps with another tree. | |
| typedef boost::mpl::if_< is_ptr_tree, fcppt::unique_ptr< stored_type >, stored_type >::type fcppt::container::tree::object< T >::arg_base_type |
The type to forward to other functions (either T or unique_ptr<T>)
| typedef boost::mpl::if_< is_ptr_tree, arg_base_type, arg_base_type const & >::type fcppt::container::tree::object< T >::arg_type |
The type to pass to other functions (either T const & or unique_ptr<T>)
| typedef boost::ptr_list< object > fcppt::container::tree::object< T >::child_list |
| typedef child_list::const_iterator fcppt::container::tree::object< T >::const_iterator |
| typedef child_list::const_reference fcppt::container::tree::object< T >::const_reference |
| typedef child_list::const_reverse_iterator fcppt::container::tree::object< T >::const_reverse_iterator |
| typedef child_list::difference_type fcppt::container::tree::object< T >::difference_type |
| typedef boost::mpl::if_< is_ptr_tree, fcppt::scoped_ptr< stored_type >, stored_type >::type fcppt::container::tree::object< T >::holder_type |
The type that holds the stored type (either T or scoped_ptr<T>)
| typedef tree::is_ptr_value< T > fcppt::container::tree::object< T >::is_ptr_tree |
| typedef child_list::iterator fcppt::container::tree::object< T >::iterator |
| typedef child_list::reference fcppt::container::tree::object< T >::reference |
| typedef child_list::reverse_iterator fcppt::container::tree::object< T >::reverse_iterator |
| typedef child_list::size_type fcppt::container::tree::object< T >::size_type |
| typedef boost::mpl::eval_if< is_ptr_tree, fcppt::mpl::inner< T >, boost::mpl::identity< T > >::type fcppt::container::tree::object< T >::stored_type |
The type to store, possibly extracted from ptr_value<T>
| typedef fcppt::unique_ptr< object > fcppt::container::tree::object< T >::unique_ptr |
| typedef T fcppt::container::tree::object< T >::value_type |
Constructs the tree using the default constructed value.
Constructs the object using the given value.
Deeply copies a tree.
| fcppt::container::tree::object< T >::reference object< T >::back | ( | ) |
Returns a reference to the last child.
Behaviour is undefined if empty is true.
| fcppt::container::tree::object< T >::const_reference object< T >::back | ( | ) | const |
Returns a reference to the last child.
Behaviour is undefined if empty is true.
| fcppt::container::tree::object< T >::iterator object< T >::begin | ( | ) |
Returns an iterator to the first child (if present)
| fcppt::container::tree::object< T >::const_iterator object< T >::begin | ( | ) | const |
Returns an iterator to the first child (if present)
| fcppt::container::tree::object< T >::const_iterator object< T >::cbegin | ( | ) | const |
Returns a const_iterator to the first child (if present)
| fcppt::container::tree::object< T >::const_iterator object< T >::cend | ( | ) | const |
Returns a const_iterator to the first child (if present)
| fcppt::container::tree::object< T >::iterator object< T >::child_position | ( | ) |
Returns an iterator pointing to the position in the parent's child container where this object resides.
Behaviour is undefined if has_parent is false
| fcppt::container::tree::object< T >::const_iterator object< T >::child_position | ( | ) | const |
Returns an iterator pointing to the position in the parent's child container where this object resides.
Behaviour is undefined if has_parent is false
| fcppt::container::tree::object< T >::child_list & object< T >::children | ( | ) |
| fcppt::container::tree::object< T >::child_list const & object< T >::children | ( | ) | const |
| void object< T >::clear | ( | ) |
Removes all children.
| fcppt::container::tree::object< T >::const_reverse_iterator object< T >::crbegin | ( | ) | const |
Returns a const_reverse_iterator to the last element (if present)
| fcppt::container::tree::object< T >::const_reverse_iterator object< T >::crend | ( | ) | const |
Returns a const_reverse_iterator to the first element (if present)
| bool object< T >::empty | ( | ) | const |
Returns if the container is empty.
| fcppt::container::tree::object< T >::iterator object< T >::end | ( | ) |
Returns an iterator to "one past the last child", if present, otherwise returns begin .
| fcppt::container::tree::object< T >::const_iterator object< T >::end | ( | ) | const |
Returns an iterator to "one past the last child", if present, otherwise returns begin .
| fcppt::container::tree::object< T >::reference object< T >::front | ( | ) |
Returns a reference to the first child.
Behaviour is undefined if empty is true.
| fcppt::container::tree::object< T >::const_reference object< T >::front | ( | ) | const |
Returns a reference to the first child.
Behaviour is undefined if empty is true.
| bool object< T >::has_parent | ( | ) | const |
Returns if this tree has a parent.
| bool object< T >::has_value | ( | ) | const |
Returns if this node holds a value Will always be true for normal trees. If the tree holds a ptr_value it depends on whether it has been initialized.
| fcppt::container::tree::object< T >::holder_type & object< T >::holder | ( | ) |
Returns a reference to the holder type.
This can be used to release the scoped_ptr if the tree has noncopyable semantics.
| fcppt::container::tree::object< T >::holder_type const & object< T >::holder | ( | ) | const |
Returns a const reference to the holder type.
| void object< T >::insert | ( | iterator | _it, |
| unique_ptr | _ptr | ||
| ) |
Inserts an element before the given iterator.
Inserts an element before the given iterator.
| fcppt::container::tree::object< T >::size_type object< T >::max_size | ( | ) | const |
Returns the ptr_list's max_size.
| fcppt::container::tree::object< T > & object< T >::operator= | ( | object< T > const & | _other | ) |
Deeply assigns a tree.
| fcppt::container::tree::object< T > & object< T >::parent | ( | ) |
Returns a reference to the parent of this tree.
If has_parent is false, behaviour is undefined.
| fcppt::container::tree::object< T > const & object< T >::parent | ( | ) | const |
Returns a reference to the parent of this tree.
If has_parent is false, behaviour is undefined.
| fcppt::container::tree::object< T > * object< T >::parent_ptr | ( | ) |
Returns a pointer to the parent of this tree.
If there is no parent, it returns 0.
| fcppt::container::tree::object< T > const * object< T >::parent_ptr | ( | ) | const |
Returns a pointer to the parent of this tree.
If there is no parent, it returns 0.
| void object< T >::pop_back | ( | ) |
Removes a child from the end of the child list.
| void object< T >::pop_front | ( | ) |
Removes a child from the front of the child list.
| void object< T >::push_back | ( | unique_ptr | _ptr | ) |
Inserts a new child at the end of the child list.
Inserts a new child at the end of the child list.
| void object< T >::push_front | ( | unique_ptr | _ptr | ) |
Adds a child in front of the child list.
Adds a child in front of the child list.
| fcppt::container::tree::object< T >::reverse_iterator object< T >::rbegin | ( | ) |
Returns a reverse_iterator to the last element (if present)
| fcppt::container::tree::object< T >::const_reverse_iterator object< T >::rbegin | ( | ) | const |
Returns a const_reverse_iterator to the last element (if present)
| fcppt::container::tree::object< T >::unique_ptr object< T >::release | ( | iterator | _it | ) |
Detaches the given child from the parent and returns it.
| fcppt::container::tree::object< T >::reverse_iterator object< T >::rend | ( | ) |
Returns a reverse_iterator to the first element (if present)
| fcppt::container::tree::object< T >::const_reverse_iterator object< T >::rend | ( | ) | const |
Returns a const_reverse_iterator to the first element (if present)
| fcppt::container::tree::object< T >::size_type object< T >::size | ( | ) | const |
Returns the number of children.
The complexity of this is O(n)
Sets a new value.
Depending on whether or not the tree has noncopyable semantics, this will either get a unique_ptr or T by value.
| fcppt::container::tree::object< T >::stored_type & object< T >::value | ( | ) |
Retrieves the tree's value.
| fcppt::container::tree::object< T >::stored_type const & object< T >::value | ( | ) | const |
Retrieves the tree's value.
1.8.2