Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::bin_node_detail Namespace Reference

Typedefs

template<class Node >
using key_of_t = std::remove_cvref_t< decltype(std::declval< Node & >().get_key())>
 The type of the key of a node, as its get_key() gives it.
 

Functions

template<class Node >
Node header_from (Node &other) noexcept(nothrow_header_from_v< Node >)
 Builds a header node of a tree that takes the nodes of another tree.
 
template<class Compare >
constexpr decltype(auto) compare_to_take (Compare &cmp) noexcept
 What a tree that takes the nodes of another takes of its comparison criteria.
 

Variables

template<typename Key >
constexpr bool nothrow_default_key_v
 Whether building a Key by default throws nothing.
 
template<class Node >
constexpr bool nothrow_from_key_of_v
 Whether a node is built without throwing from the key of another node, which is moved.
 
template<class Node >
constexpr bool nothrow_header_from_v
 Whether header_from() builds a header node without throwing.
 
template<class Compare >
constexpr bool nothrow_compare_taken_v
 Whether a tree takes without throwing the comparison criteria that compare_to_take() gives it.
 

Typedef Documentation

◆ key_of_t

template<class Node >
using Aleph::bin_node_detail::key_of_t = typedef std::remove_cvref_t<decltype(std::declval<Node &>().get_key())>

The type of the key of a node, as its get_key() gives it.

Template Parameters
NodeThe type of the nodes of a tree.

Definition at line 157 of file tpl_binNode.H.

Function Documentation

◆ compare_to_take()

template<class Compare >
constexpr decltype(auto) Aleph::bin_node_detail::compare_to_take ( Compare &  cmp)
constexprnoexcept

What a tree that takes the nodes of another takes of its comparison criteria.

The criteria to copy, from a const one if they have that copy, or else from one that is not const: the tree to move from keeps its own, and takes nodes again in the same order. Criteria that cannot be copied are moved, and that tree keeps criteria that were moved from.

Template Parameters
CompareThe type of the comparison criteria.
Parameters
[in,out]cmpThe comparison criteria of the tree to move from.
Returns
cmp: a reference to const, or to non-const, to copy it, or an rvalue, to move it.

Definition at line 242 of file tpl_binNode.H.

References cmp().

◆ header_from()

template<class Node >
Node Aleph::bin_node_detail::header_from ( Node &  other)
noexcept

Builds a header node of a tree that takes the nodes of another tree.

A header node is a node, and so it holds a key, which no tree reads. A tree that is built empty builds that node by default, and with it its key and its control data. A tree that takes the place of another builds no key, if it can:

Default construction of the node Construction from the key of other, moved The key of the header
cannot throw any built by default
may throw cannot throw that of other, moved
may throw may throw built by default

The node built by default builds its key and its control data by default; the one built from a key builds its control data by default too. With the nodes of the library, whose control data are built without throwing, the rows go by the key: no key is built, and nothing is allocated, with a key whose default construction allocates and whose move does not, as an Array; and a key that is built by default without throwing is built as it always was. In the second row, other keeps a key that was moved from, which nobody reads either.

Template Parameters
NodeThe type of the nodes of the tree.
Parameters
[in,out]otherThe same header node of the tree to move from.
Returns
The header node, with its two links to Node::NullPtr and the control data of a node built by default.
Exceptions
Whatthe default construction of the node throws, in the third row: that of its key or of its control data. Nothing in the other two.

Definition at line 217 of file tpl_binNode.H.

Referenced by TEST().

Variable Documentation

◆ nothrow_compare_taken_v

template<class Compare >
constexpr bool Aleph::bin_node_detail::nothrow_compare_taken_v
inlineconstexpr
Initial value:
=
std::is_nothrow_constructible_v<Compare,
decltype(compare_to_take(std::declval<Compare &>()))>
constexpr decltype(auto) compare_to_take(Compare &cmp) noexcept
What a tree that takes the nodes of another takes of its comparison criteria.

Whether a tree takes without throwing the comparison criteria that compare_to_take() gives it.

Template Parameters
CompareThe type of the comparison criteria of a tree.

Definition at line 257 of file tpl_binNode.H.

◆ nothrow_default_key_v

template<typename Key >
constexpr bool Aleph::bin_node_detail::nothrow_default_key_v
inlineconstexpr
Initial value:
=
std::is_nothrow_default_constructible_v<Key>

Whether building a Key by default throws nothing.

A std::pair, the key of the nodes of a map, is looked into: its default constructor builds its two members by default and nothing else, but the one of libstdc++ is not declared noexcept, and those of libc++ and of the library of MSVC are.

Template Parameters
KeyThe type of the key of a node.

Definition at line 145 of file tpl_binNode.H.

◆ nothrow_from_key_of_v

template<class Node >
constexpr bool Aleph::bin_node_detail::nothrow_from_key_of_v
inlineconstexpr
Initial value:
=
noexcept(std::declval<Node &>().get_key()) and
std::is_nothrow_constructible_v<Node, key_of_t<Node> &&>
WeightedDigraph::Node Node

Whether a node is built without throwing from the key of another node, which is moved.

Its get_key() and its construction from a key that is moved cannot throw. Those of the nodes of the library cannot, but a node of the user may have a get_key() that throws.

Template Parameters
NodeThe type of the nodes of a tree.

Definition at line 169 of file tpl_binNode.H.

◆ nothrow_header_from_v

template<class Node >
constexpr bool Aleph::bin_node_detail::nothrow_header_from_v
inlineconstexpr
Initial value:
=
std::is_nothrow_default_constructible_v<Node> or nothrow_from_key_of_v<Node>

Whether header_from() builds a header node without throwing.

It does when the node is built by default without throwing, or when it is built without throwing from the key of another node.

Template Parameters
NodeThe type of the nodes of a tree.

Definition at line 181 of file tpl_binNode.H.