libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches

This page contains documentation related to safely constructing a Forest instance.

See also
The `make` function for an overview of possible uses of the make function.

Functions

template<typename Return>
enable_if_is_same< Return, Forestmake (std::initializer_list< size_t > parent, std::initializer_list< size_t > edge_labels)
 Construct a Forest from parents and labels.
 
template<typename Return>
enable_if_is_same< Return, Forestmake (std::vector< size_t > parent, std::vector< size_t > edge_labels)
 Construct a Forest from parents and labels.
 

Function Documentation

◆ make() [1/2]

template<typename Return>
enable_if_is_same< Return, Forest > make ( std::initializer_list< size_t > parent,
std::initializer_list< size_t > edge_labels )
nodiscard

This function constructs a Forest from initializer lists of parents and labels.

Template Parameters
Returnthe return type. Must satisfy std::is_same<Return, Forest>.
Parameters
parentthe initializer list of parents of nodes in the Forest.
edge_labelsthe initializer list of edge labels in the Forest.
Returns
A newly constructed Forest with parents parent and edge labels edge_labels.
Exceptions
LibsemigroupsExceptionif any of the following hold:
  • parent and edge_labels have different sizes;
  • parent and edge_labels do not have the value UNDEFINED in the same positions (these values indicate where the roots of the trees in the forest are located and so must coincide).
  • Forest::set_parent_and_label throws for parent[i] and edge_labels[i] for any value of i.

◆ make() [2/2]

template<typename Return>
enable_if_is_same< Return, Forest > make ( std::vector< size_t > parent,
std::vector< size_t > edge_labels )
nodiscard

This function constructs a Forest from vector of parents and labels.

Template Parameters
Returnthe return type. Must satisfy std::is_same<Return, Forest>.
Parameters
parentthe vector of parents of nodes in the Forest.
edge_labelsthe vector of edge labels in the Forest.
Returns
A newly constructed Forest with parents parent and edge labels edge_labels.
Exceptions
LibsemigroupsExceptionif any of the following hold:
  • parent and edge_labels have different sizes;
  • parent and edge_labels do not have the value UNDEFINED in the same positions (these values indicate where the roots of the trees in the forest are located and so must coincide).
  • Forest::set_parent_and_label throws for parent[i] and edge_labels[i] for any value of i.