1#ifndef LIBTEDDY_DETAILS_DIAGRAM_HPP
2#define LIBTEDDY_DETAILS_DIAGRAM_HPP
4#include <libteddy/details/node.hpp>
5#include <libteddy/details/node_manager.hpp>
6#include <libteddy/details/tools.hpp>
18template<
class Data,
class Degree>
98template<
class Data,
class Degree>
99auto swap (diagram<Data, Degree>& lhs, diagram<Data, Degree>& rhs) ->
void
110template<
class Data,
class Degree>
112 diagram<Data, Degree>
const& lhs,
113 diagram<Data, Degree>
const& rhs
116 return lhs.equals(rhs);
125template<
class Data,
class Degree>
126auto equals (diagram<Data, Degree> lhs, diagram<Data, Degree> rhs) ->
bool
128 return lhs.equals(rhs);
131template<
class Data,
class Degree>
133 root_(id_set_notmarked(id_inc_ref_count(root)))
137template<
class Data,
class Degree>
139 root_(id_inc_ref_count(other.root_))
143template<
class Data,
class Degree>
145 root_(utils::exchange(other.root_,
nullptr))
149template<
class Data,
class Degree>
154 root_->dec_ref_count();
158template<
class Data,
class Degree>
165template<
class Data,
class Degree>
168 utils::swap(root_, other.root_);
171template<
class Data,
class Degree>
174 return root_ == other.unsafe_get_root();
177template<
class Data,
class Degree>
186template<
class Data,
class Degree>
187struct hash<teddy::diagram<Data, Degree>>
190 )
const noexcept -> std::size_t
196template<
class Data,
class Degree>
197struct equal_to<teddy::diagram<Data, Degree>>
199 [[nodiscard]]
auto operator() (
202 )
const noexcept ->
bool
Cheap wrapper for the internal diagram node type.
Definition diagram.hpp:20
auto equals(diagram const &other) const -> bool
Compares node pointers in this and other diagram.
Definition diagram.hpp:172
auto operator=(diagram other) -> diagram &
Assigns pointer from the other diagram.
Definition diagram.hpp:159
auto unsafe_get_root() const -> node_t *
Returns pointer to internal node type. You should probably don't use this one unless you know what yo...
Definition diagram.hpp:178
~diagram()
Destructor. Ensures correct reference counting using RAII pattern.
Definition diagram.hpp:150
auto swap(diagram &other) -> void
Swaps pointers in this and other diagram.
Definition diagram.hpp:166
diagram()=default
Default constructed diagram. Points to no node and should not be used.