A library for working with phylogenetic and population genetic data.
v0.32.0
TreeSet Class Reference

#include <genesis/tree/tree_set.hpp>

Detailed Description

Definition at line 48 of file tree_set.hpp.

Public Member Functions

 TreeSet ()=default
 
 TreeSet (TreeSet &&)=default
 
 TreeSet (TreeSet const &)=default
 
 ~TreeSet ()=default
 
void add (Tree &&tree, std::string const &name="")
 Add a Tree with a name to the TreeSet. More...
 
void add (Tree const &tree, std::string const &name="")
 Add a Tree with a name to the TreeSet. More...
 
Treeat (size_t index)
 
Tree const & at (size_t index) const
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 Clear the TreeSet and destroy all contained Trees. More...
 
bool empty () const
 Return whether the TreeSet is empty. More...
 
iterator end ()
 
const_iterator end () const
 
std::string const & name_at (size_t index) const
 
std::vector< std::string > const & names () const
 
 operator std::vector< Tree > const & () const
 Implicit conversion, so that a TreeSet can be used in functions that expect a std::vector instead. More...
 
TreeSetoperator= (TreeSet &&)=default
 
TreeSetoperator= (TreeSet const &)=default
 
Treeoperator[] (const std::size_t index)
 
Tree const & operator[] (const std::size_t index) const
 
void remove_at (size_t index)
 Remove the Tree at a certain index position. More...
 
size_t size () const
 Return the size of the TreeSet, i.e., the number of stored Trees. More...
 
void swap (TreeSet &other)
 
std::vector< Tree > const & trees () const
 

Public Types

using const_iterator = typename std::vector< Tree >::const_iterator
 
using iterator = typename std::vector< Tree >::iterator
 

Constructor & Destructor Documentation

◆ TreeSet() [1/3]

TreeSet ( )
default

◆ ~TreeSet()

~TreeSet ( )
default

◆ TreeSet() [2/3]

TreeSet ( TreeSet const &  )
default

◆ TreeSet() [3/3]

TreeSet ( TreeSet &&  )
default

Member Function Documentation

◆ add() [1/2]

void add ( Tree &&  tree,
std::string const &  name = "" 
)
inline

Add a Tree with a name to the TreeSet.

The Tree is moved.

Definition at line 99 of file tree_set.hpp.

◆ add() [2/2]

void add ( Tree const &  tree,
std::string const &  name = "" 
)
inline

Add a Tree with a name to the TreeSet.

The Tree is copied.

Definition at line 88 of file tree_set.hpp.

◆ at() [1/2]

Tree& at ( size_t  index)
inline

Definition at line 178 of file tree_set.hpp.

◆ at() [2/2]

Tree const& at ( size_t  index) const
inline

Definition at line 183 of file tree_set.hpp.

◆ begin() [1/2]

iterator begin ( )
inline

Definition at line 158 of file tree_set.hpp.

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Definition at line 163 of file tree_set.hpp.

◆ clear()

void clear ( )
inline

Clear the TreeSet and destroy all contained Trees.

Definition at line 128 of file tree_set.hpp.

◆ empty()

bool empty ( ) const
inline

Return whether the TreeSet is empty.

Definition at line 219 of file tree_set.hpp.

◆ end() [1/2]

iterator end ( )
inline

Definition at line 168 of file tree_set.hpp.

◆ end() [2/2]

const_iterator end ( ) const
inline

Definition at line 173 of file tree_set.hpp.

◆ name_at()

std::string const& name_at ( size_t  index) const
inline

Definition at line 138 of file tree_set.hpp.

◆ names()

std::vector<std::string> const& names ( ) const
inline

Definition at line 149 of file tree_set.hpp.

◆ operator std::vector< Tree > const &()

operator std::vector< Tree > const & ( ) const
inline

Implicit conversion, so that a TreeSet can be used in functions that expect a std::vector instead.

Definition at line 207 of file tree_set.hpp.

◆ operator=() [1/2]

TreeSet& operator= ( TreeSet &&  )
default

◆ operator=() [2/2]

TreeSet& operator= ( TreeSet const &  )
default

◆ operator[]() [1/2]

Tree& operator[] ( const std::size_t  index)
inline

Definition at line 188 of file tree_set.hpp.

◆ operator[]() [2/2]

Tree const& operator[] ( const std::size_t  index) const
inline

Definition at line 193 of file tree_set.hpp.

◆ remove_at()

void remove_at ( size_t  index)
inline

Remove the Tree at a certain index position.

As this function moves Trees in the container around, all iterators and pointers to the elements of this TreeSet are considered to be invalidated.

Definition at line 111 of file tree_set.hpp.

◆ size()

size_t size ( ) const
inline

Return the size of the TreeSet, i.e., the number of stored Trees.

Definition at line 228 of file tree_set.hpp.

◆ swap()

void swap ( TreeSet other)
inline

Definition at line 72 of file tree_set.hpp.

◆ trees()

std::vector<Tree> const& trees ( ) const
inline

Definition at line 198 of file tree_set.hpp.

Member Typedef Documentation

◆ const_iterator

using const_iterator = typename std::vector<Tree>::const_iterator

Definition at line 57 of file tree_set.hpp.

◆ iterator

using iterator = typename std::vector<Tree>::iterator

Definition at line 56 of file tree_set.hpp.


The documentation for this class was generated from the following file: