ROSE
0.11.137.0
|
A 1:N tree edge from parent to children.
This edge type points to a variable number of children and acts like an std::vector
.
#include <util/Sawyer/Tree.h>
Classes | |
class | Iterator |
Public Types | |
using | Child = T |
Type of children being pointed to. More... | |
using | ChildPtr = std::shared_ptr< Child > |
Type of pointers to children. More... | |
using | value_type = Edge< Child > |
using | size_type = typename Vector::size_type |
using | difference_type = typename Vector::difference_type |
using | reference = value_type & |
using | const_reference = const value_type & |
using | iterator = Iterator< typename Vector::iterator > |
Public Member Functions | |
~EdgeVector () | |
Destructor clears children's parents. More... | |
EdgeVector (UserBase &parent) | |
Construct a child edge that belongs to the specified parent. More... | |
bool | empty () const |
Test whether vector is empty. More... | |
size_t | size () const override |
Number of child edges. More... | |
void | reserve (size_t n) |
Reserve space so the child edge vector can grow without being reallocated. More... | |
size_t | capacity () const |
Reserved capacity. More... | |
void | push_back (const ChildPtr &elmt) |
Insert a child pointer at the end of this vertex. More... | |
void | pop_back () |
Erase a child edge from the end of this vertex. More... | |
iterator | begin () |
Return an iterator to the first edge. More... | |
iterator | end () |
Return an iterator to one past the last edge. More... | |
const Edge< Child > & | at (size_t i) const |
Return the i'th edge. | |
Edge< Child > & | at (size_t i) |
Return the i'th edge. | |
const Edge< Child > & | operator[] (size_t i) const |
Return the i'th edge. | |
Edge< Child > & | operator[] (size_t i) |
Return the i'th edge. | |
const Edge< Child > & | front () const |
Return the first edge. | |
Edge< Child > & | front () |
Return the first edge. | |
const Edge< Child > & | back () const |
Return the last edge. | |
Edge< Child > & | back () |
Return the last edge. | |
Protected Member Functions | |
Vertex * | pointer (size_t i) const override |
using Sawyer::Tree::Vertex< B >::EdgeVector< T >::ChildPtr = std::shared_ptr<Child> |
|
inline |
|
explicit |
Construct a child edge that belongs to the specified parent.
When constructing a class containing a data member of this type (i.e., a tree edge that points to a child of this vertex), the data member must be initialized by passing *this
as the argument. See the example in this class documentation.
|
inline |
Test whether vector is empty.
Returns true if this vertex contains no child edges, null or otherwise.
Definition at line 581 of file Tree.h.
Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back(), and Sawyer::Tree::Vertex< B >::EdgeVector< T >::front().
|
inlineoverride |
Number of child edges.
Returns the number of children edges, null or otherwise.
Definition at line 588 of file Tree.h.
Referenced by Sawyer::Tree::Vertex< B >::EdgeVector< T >::back().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |