CPPX 1.1.2
A Modern C++ Utility Library
Loading...
Searching...
No Matches
stl_ext::BinaryTree< T > Class Template Reference

#include <cppx.h>

Inheritance diagram for stl_ext::BinaryTree< T >:
Collaboration diagram for stl_ext::BinaryTree< T >:

Public Member Functions

 BinaryTree ()
 
 BinaryTree (const BinaryTree &other)
 
BinaryTreeoperator= (const BinaryTree &other)
 
 BinaryTree (BinaryTree &&other) noexcept=default
 
BinaryTreeoperator= (BinaryTree &&other) noexcept=default
 
virtual ~BinaryTree ()=default
 
Node< T > * get_root () const
 
void set_root (std::unique_ptr< Node< T > > root)
 
bool is_empty () const
 
int size () const
 
void print_preorder () const
 
void print_inorder () const
 
void print_postorder () const
 
void print_levelorder () const
 
void set_left (Node< T > *parent, std::unique_ptr< Node< T > > left_child)
 
void set_right (Node< T > *parent, std::unique_ptr< Node< T > > right_child)
 

Static Public Member Functions

static std::unique_ptr< Node< T > > make_node (const T &val)
 
static std::unique_ptr< Node< T > > make_node (const T &val, std::unique_ptr< Node< T > > left, std::unique_ptr< Node< T > > right)
 

Protected Member Functions

void preorder (const Node< T > *node) const
 
void inorder (const Node< T > *node) const
 
void postorder (const Node< T > *node) const
 
void levelorder (const Node< T > *node) const
 
int compute_size (const Node< T > *node) const
 

Protected Attributes

std::unique_ptr< Node< T > > p_head
 

Detailed Description

template<typename T>
class stl_ext::BinaryTree< T >

Definition at line 52 of file cppx.h.

Constructor & Destructor Documentation

◆ BinaryTree() [1/3]

template<typename T >
stl_ext::BinaryTree< T >::BinaryTree ( )
inline

Definition at line 63 of file cppx.h.

◆ BinaryTree() [2/3]

template<typename T >
stl_ext::BinaryTree< T >::BinaryTree ( const BinaryTree< T > &  other)

Definition at line 109 of file binary_tree.tpp.

◆ BinaryTree() [3/3]

template<typename T >
stl_ext::BinaryTree< T >::BinaryTree ( BinaryTree< T > &&  other)
defaultnoexcept

◆ ~BinaryTree()

template<typename T >
virtual stl_ext::BinaryTree< T >::~BinaryTree ( )
virtualdefault

Member Function Documentation

◆ compute_size()

template<typename T >
int stl_ext::BinaryTree< T >::compute_size ( const Node< T > *  node) const
protected

Definition at line 89 of file binary_tree.tpp.

◆ get_root()

template<typename T >
Node< T > * stl_ext::BinaryTree< T >::get_root ( ) const

Definition at line 123 of file binary_tree.tpp.

◆ inorder()

template<typename T >
void stl_ext::BinaryTree< T >::inorder ( const Node< T > *  node) const
protected

Definition at line 24 of file binary_tree.tpp.

◆ is_empty()

template<typename T >
bool stl_ext::BinaryTree< T >::is_empty ( ) const

Definition at line 133 of file binary_tree.tpp.

◆ levelorder()

template<typename T >
void stl_ext::BinaryTree< T >::levelorder ( const Node< T > *  node) const
protected

Definition at line 71 of file binary_tree.tpp.

◆ make_node() [1/2]

template<typename T >
std::unique_ptr< Node< T > > stl_ext::BinaryTree< T >::make_node ( const T val)
static

Definition at line 188 of file binary_tree.tpp.

◆ make_node() [2/2]

template<typename T >
std::unique_ptr< Node< T > > stl_ext::BinaryTree< T >::make_node ( const T val,
std::unique_ptr< Node< T > >  left,
std::unique_ptr< Node< T > >  right 
)
static

Definition at line 194 of file binary_tree.tpp.

◆ operator=() [1/2]

template<typename T >
BinaryTree & stl_ext::BinaryTree< T >::operator= ( BinaryTree< T > &&  other)
defaultnoexcept

◆ operator=() [2/2]

template<typename T >
BinaryTree< T > & stl_ext::BinaryTree< T >::operator= ( const BinaryTree< T > &  other)

Definition at line 115 of file binary_tree.tpp.

◆ postorder()

template<typename T >
void stl_ext::BinaryTree< T >::postorder ( const Node< T > *  node) const
protected

Definition at line 42 of file binary_tree.tpp.

◆ preorder()

template<typename T >
void stl_ext::BinaryTree< T >::preorder ( const Node< T > *  node) const
protected

Definition at line 6 of file binary_tree.tpp.

◆ print_inorder()

template<typename T >
void stl_ext::BinaryTree< T >::print_inorder ( ) const

Definition at line 172 of file binary_tree.tpp.

◆ print_levelorder()

template<typename T >
void stl_ext::BinaryTree< T >::print_levelorder ( ) const

Definition at line 182 of file binary_tree.tpp.

◆ print_postorder()

template<typename T >
void stl_ext::BinaryTree< T >::print_postorder ( ) const

Definition at line 177 of file binary_tree.tpp.

◆ print_preorder()

template<typename T >
void stl_ext::BinaryTree< T >::print_preorder ( ) const

Definition at line 167 of file binary_tree.tpp.

◆ set_left()

template<typename T >
void stl_ext::BinaryTree< T >::set_left ( Node< T > *  parent,
std::unique_ptr< Node< T > >  left_child 
)

Definition at line 143 of file binary_tree.tpp.

◆ set_right()

template<typename T >
void stl_ext::BinaryTree< T >::set_right ( Node< T > *  parent,
std::unique_ptr< Node< T > >  right_child 
)

Definition at line 155 of file binary_tree.tpp.

◆ set_root()

template<typename T >
void stl_ext::BinaryTree< T >::set_root ( std::unique_ptr< Node< T > >  root)

Definition at line 128 of file binary_tree.tpp.

◆ size()

template<typename T >
int stl_ext::BinaryTree< T >::size ( ) const

Definition at line 138 of file binary_tree.tpp.

Member Data Documentation

◆ p_head

template<typename T >
std::unique_ptr<Node<T> > stl_ext::BinaryTree< T >::p_head
protected

Definition at line 55 of file cppx.h.


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