48 template<
class WeightHandler, std::
integral IndexType>
49 requires object::handler<WeightHandler>
53 using weight_handler_type = WeightHandler;
54 using weight_type =
typename WeightHandler::value_type;
57 constexpr const weight_type& weight()
const noexcept {
return WeightHandler::get(m_Weight); }
60 constexpr weight_type& weight()
noexcept {
return WeightHandler::get(m_Weight); }
62 constexpr void weight(weight_type w)
64 WeightHandler::get(m_Weight) = std::move(w);
67 template<
class... Args>
68 requires ((
sizeof...(Args) > 0) && is_initializable_v<weight_type, Args...>)
69 constexpr void weight(Args&&... args)
71 WeightHandler::get(m_Weight) = weight_type{std::forward<Args>(args)...};
74 template<std::invocable<weight_type&> Fn>
75 constexpr std::invoke_result_t<Fn, weight_type&> mutate_weight(Fn fn)
77 return fn(WeightHandler::get(m_Weight));
82 requires is_deep_equality_comparable_v<weight_type>
84 return lhs.weight() == rhs.weight();
89 template<
class... Args>
90 requires (!resolve_to_copy_v<
weighting, Args...>)
91 constexpr explicit(
sizeof...(Args) == 1)
weighting(Args&&... args)
92 : m_Weight{WeightHandler::producer_type::make(std::forward<Args>(args)...)}
96 : m_Weight{WeightHandler::producer_type::make(WeightHandler::get(other.m_Weight))}
100 requires std::is_base_of_v<weighting, std::remove_cvref_t<Other>>
101 constexpr weighting(Other&& other) : m_Weight{other.m_Weight}
108 if(&other !=
this) m_Weight = WeightHandler::producer_type::make(WeightHandler::get(other.m_Weight));
114 typename WeightHandler::product_type m_Weight;
122 template<
class WeightHandler, std::
integral IndexType>
127 using weight_handler_type = WeightHandler;
128 using weight_type =
typename WeightHandler::value_type;
131 friend constexpr bool operator==(
const weighting&,
const weighting&)
noexcept =
default;
133 constexpr weighting()
noexcept =
default;
150 template<
class WeightHandler, std::
integral IndexType>
155 using index_type = IndexType;
156 using weight_type =
typename weighting<WeightHandler, IndexType>::weight_type;
158 template<
class... Args>
160 constexpr explicit(
sizeof...(Args) == 0)
partial_edge_base(
const index_type target, Args&&... args)
174 constexpr IndexType target_node()
const noexcept {
return m_Target; }
176 constexpr void target_node(
const index_type target)
noexcept { m_Target = target; }
191 template<
class WeightHandler,
class MetaData, std::
integral IndexType>
198 template<
class OtherHandler>
199 requires (
object::handler<OtherHandler> && !std::is_same_v<WeightHandler, OtherHandler> && std::is_same_v<typename OtherHandler::value_type, typename WeightHandler::value_type>)
214 template<
class WeightHandler,
class MetaData, std::
integral IndexType>
219 using index_type = IndexType;
220 using meta_data_type = MetaData;
221 using weight_type =
typename partial_edge_base<WeightHandler, IndexType>::weight_type;
224 requires is_initializable_v<MetaData> && is_initializable_v<weight_type>
230 requires (std::is_empty_v<weight_type> && !std::is_empty_v<meta_data_type>)
232 , m_MetaData{std::move(m)}
236 requires (!std::is_empty_v<weight_type> && !std::is_empty_v<meta_data_type>)
238 , m_MetaData{std::move(m)}
243 , m_MetaData{std::move(m)}
247 template<
class OtherHandler>
248 requires (
object::handler<OtherHandler> && !std::is_same_v<WeightHandler, OtherHandler> && std::is_same_v<typename OtherHandler::value_type, typename WeightHandler::value_type>)
251 , m_MetaData{other.meta_data()}
259 constexpr const MetaData& meta_data()
const noexcept {
return m_MetaData; }
261 constexpr void meta_data(MetaData m) { m_MetaData = std::move(m); }
263 template<
class... Args>
264 requires ((
sizeof...(Args) > 0) && is_initializable_v<meta_data_type, Args...>)
265 constexpr void meta_data(Args&&... args)
267 m_MetaData = {std::forward<Args>(args)...};
270 template<std::invocable<meta_data_type&> Fn>
271 constexpr std::invoke_result_t<Fn, meta_data_type&> mutate_meta_data(Fn fn)
273 return fn(m_MetaData);
291 enum class edge_flavour :
bool { partial, partial_embedded };
300 template<
class WeightHandler,
class MetaData, std::
integral IndexType=std::
size_t>
305 constexpr static edge_flavour flavour{edge_flavour::partial};
307 using weight_type =
typename decorated_partial_edge_base<WeightHandler, MetaData, IndexType>::weight_type;
308 using meta_data_type = MetaData;
309 using index_type = IndexType;
325 template<
class WeightHandler,
class MetaData, std::
integral IndexType=std::
size_t>
330 constexpr static edge_flavour flavour{edge_flavour::partial_embedded};
332 using weight_type =
typename decorated_partial_edge_base<WeightHandler, MetaData, IndexType>::weight_type;
333 using meta_data_type = MetaData;
334 using index_type = IndexType;
336 template<
class... Args>
338 constexpr embedded_partial_edge(
const index_type target,
const index_type complimentaryIndex, Args&&... args)
340 , m_ComplementaryIndex{complimentaryIndex}
344 requires std::is_empty_v<meta_data_type>
346 , m_ComplementaryIndex{complimentaryIndex}
351 , m_ComplementaryIndex{complimentaryIndex}
354 template<
class OtherHandler>
355 requires (
object::handler<OtherHandler> && !std::is_same_v<WeightHandler, OtherHandler> && std::is_same_v<typename OtherHandler::value_type, typename WeightHandler::value_type>)
358 , m_ComplementaryIndex{other.complementary_index()}
368 constexpr index_type complementary_index()
const noexcept {
return m_ComplementaryIndex; }
369 constexpr void complementary_index(
const index_type index)
noexcept { m_ComplementaryIndex = index; }
374 IndexType m_ComplementaryIndex;
Concepts which are sufficiently general to appear in the sequoia namespace.
Utilities for both edges and nodes.
Traits and Concepts for Sharing Policies.
Traits which are sufficiently general to appear in the sequoia namespace.
Decoration of a partial_edge to record the location on the target node into which the edge is embedde...
Definition: Edge.hpp:328
Combines the edge_base and weighting class.
Definition: Edge.hpp:153
A concrete edge containing a target index and, optionally, a weight.
Definition: Edge.hpp:303
A class to store non-trivial edge weights.
Definition: Edge.hpp:51
Definition: HandlerTraits.hpp:20