@@ -35,7 +35,7 @@ class graph final {
3535 using vertex_type = typename traits_type::vertex_type;
3636 using vertex_properties_type = typename traits_type::vertex_properties_type;
3737 using vertex_properties_map_type = std::conditional_t <
38- type_traits::is_default_properties_type_v <vertex_properties_type>,
38+ type_traits::c_empty_properties <vertex_properties_type>,
3939 types::empty_properties_map,
4040 std::vector<std::unique_ptr<vertex_properties_type>>>;
4141
@@ -44,7 +44,7 @@ class graph final {
4444 using edge_properties_type = typename traits_type::edge_properties_type;
4545
4646 using edge_properties_map_type = std::conditional_t <
47- type_traits::is_default_properties_type_v <edge_properties_type>,
47+ type_traits::c_empty_properties <edge_properties_type>,
4848 types::empty_properties_map,
4949 std::vector<std::unique_ptr<edge_properties_type>>>;
5050
@@ -54,7 +54,7 @@ class graph final {
5454 graph () = default ;
5555
5656 explicit graph (const types::size_type n_vertices) : _n_vertices(n_vertices), _impl(n_vertices) {
57- if constexpr (not type_traits::is_default_properties_type_v <vertex_properties_type>) {
57+ if constexpr (type_traits::c_non_empty_properties <vertex_properties_type>) {
5858 this ->_vertex_properties .reserve (n_vertices);
5959 for (const auto _ : this ->vertex_ids ())
6060 this ->_vertex_properties .push_back (std::make_unique<vertex_properties_type>());
@@ -79,14 +79,14 @@ class graph final {
7979 // --- vertex methods ---
8080
8181 [[nodiscard]] gl_attr_force_inline auto vertices () const
82- requires(type_traits::is_default_properties_type_v <vertex_properties_type>)
82+ requires(type_traits::c_empty_properties <vertex_properties_type>)
8383 {
8484 return this ->vertex_ids ()
8585 | std::views::transform ([](const types::id_type id) { return vertex_descriptor{id}; });
8686 }
8787
8888 [[nodiscard]] gl_attr_force_inline auto vertices () const
89- requires(not type_traits::is_default_properties_type_v <vertex_properties_type>)
89+ requires(type_traits::c_non_empty_properties <vertex_properties_type>)
9090 {
9191 return this ->_vertex_properties | std::views::enumerate
9292 | std::views::transform ([](const auto & x) {
@@ -105,7 +105,7 @@ class graph final {
105105
106106 [[nodiscard]] gl_attr_force_inline vertex_type get_vertex (const types::id_type vertex_id) const {
107107 this ->_verify_vertex_id (vertex_id);
108- if constexpr (type_traits::is_default_properties_type_v <vertex_properties_type>)
108+ if constexpr (type_traits::c_empty_properties <vertex_properties_type>)
109109 return vertex_descriptor{vertex_id};
110110 else
111111 return vertex_descriptor{vertex_id, *this ->_vertex_properties [vertex_id]};
@@ -125,7 +125,7 @@ class graph final {
125125 this ->_impl .add_vertex ();
126126 const auto new_vertex_id = this ->_n_vertices ++;
127127
128- if constexpr (type_traits::is_default_properties_type_v <vertex_properties_type>)
128+ if constexpr (type_traits::c_empty_properties <vertex_properties_type>)
129129 return vertex_descriptor{new_vertex_id};
130130 else {
131131 this ->_vertex_properties .push_back (std::make_unique<vertex_properties_type>());
@@ -134,7 +134,7 @@ class graph final {
134134 }
135135
136136 vertex_type add_vertex (vertex_properties_type properties)
137- requires(not type_traits::is_default_properties_type_v <vertex_properties_type>)
137+ requires(type_traits::c_non_empty_properties <vertex_properties_type>)
138138 {
139139 this ->_impl .add_vertex ();
140140 this ->_vertex_properties .push_back (
@@ -147,7 +147,7 @@ class graph final {
147147 this ->_impl .add_vertices (n);
148148 this ->_n_vertices += n;
149149
150- if constexpr (not type_traits::is_default_properties_type_v <vertex_properties_type>) {
150+ if constexpr (type_traits::c_non_empty_properties <vertex_properties_type>) {
151151 const auto old_size = this ->_vertex_properties .size ();
152152 this ->_vertex_properties .reserve (this ->_n_vertices );
153153 for (types::size_type i = old_size; i < this ->_n_vertices ; ++i)
@@ -158,14 +158,14 @@ class graph final {
158158 void add_vertices_with (
159159 const type_traits::c_sized_range_of<vertex_properties_type> auto & properties_range
160160 )
161- requires(not type_traits::is_default_properties_type_v <vertex_properties_type>)
161+ requires(type_traits::c_non_empty_properties <vertex_properties_type>)
162162 {
163163 const auto n = std::ranges::size (properties_range);
164164
165165 this ->_impl .add_vertices (n);
166166 this ->_n_vertices += n;
167167
168- if constexpr (not type_traits::is_default_properties_type_v <vertex_properties_type>) {
168+ if constexpr (type_traits::c_non_empty_properties <vertex_properties_type>) {
169169 for (auto & properties : properties_range) {
170170 this ->_vertex_properties .emplace_back (
171171 std::make_unique<vertex_properties_type>(properties)
@@ -250,7 +250,7 @@ class graph final {
250250 }
251251
252252 [[nodiscard]] gl_attr_force_inline auto vertex_properties_map () const noexcept
253- requires(not type_traits::is_default_properties_type_v <vertex_properties_type>)
253+ requires(type_traits::c_non_empty_properties <vertex_properties_type>)
254254 {
255255 return util::deref_view (this ->_vertex_properties );
256256 }
@@ -269,7 +269,7 @@ class graph final {
269269 const auto new_edge_id = this ->_n_unique_edges ++;
270270 this ->_impl .add_edge (new_edge_id, first_id, second_id);
271271
272- if constexpr (type_traits::is_default_properties_type_v <edge_properties_type>) {
272+ if constexpr (type_traits::c_empty_properties <edge_properties_type>) {
273273 return edge_type{new_edge_id, first_id, second_id};
274274 }
275275 else {
@@ -283,7 +283,7 @@ class graph final {
283283 const types::id_type second_id,
284284 const edge_properties_type& properties
285285 )
286- requires(not type_traits::is_default_properties_type_v <edge_properties_type>)
286+ requires(type_traits::c_non_empty_properties <edge_properties_type>)
287287 {
288288 this ->_verify_vertex_id (first_id);
289289 this ->_verify_vertex_id (second_id);
@@ -305,7 +305,7 @@ class graph final {
305305 const gl_attr_force_inline edge_type add_edge (
306306 const vertex_type& first, const vertex_type& second, const edge_properties_type& properties
307307 )
308- requires(not type_traits::is_default_properties_type_v <edge_properties_type>)
308+ requires(type_traits::c_non_empty_properties <edge_properties_type>)
309309 {
310310 return this ->add_edge (first.id (), second.id (), properties);
311311 }
@@ -319,7 +319,7 @@ class graph final {
319319
320320 for (const auto target_id : target_id_range) {
321321 this ->_verify_vertex_id (target_id);
322- if constexpr (not type_traits::is_default_properties_type_v <edge_properties_type>)
322+ if constexpr (type_traits::c_non_empty_properties <edge_properties_type>)
323323 this ->_edge_properties .emplace_back (std::make_unique<edge_properties_type>());
324324 }
325325
@@ -339,7 +339,7 @@ class graph final {
339339
340340 for (const auto & target : target_range) {
341341 this ->_verify_vertex_id (target.id ());
342- if constexpr (not type_traits::is_default_properties_type_v <edge_properties_type>)
342+ if constexpr (type_traits::c_non_empty_properties <edge_properties_type>)
343343 this ->_edge_properties .emplace_back (std::make_unique<edge_properties_type>());
344344 }
345345
@@ -376,7 +376,7 @@ class graph final {
376376 this ->_verify_vertex_id (first_id);
377377 this ->_verify_vertex_id (second_id);
378378
379- if constexpr (type_traits::is_default_properties_type_v <edge_properties_type>)
379+ if constexpr (type_traits::c_empty_properties <edge_properties_type>)
380380 return this ->_impl .get_edge (first_id, second_id);
381381 else
382382 return this ->_impl .get_edge (first_id, second_id, this ->_edge_properties );
@@ -394,7 +394,7 @@ class graph final {
394394 this ->_verify_vertex_id (first_id);
395395 this ->_verify_vertex_id (second_id);
396396
397- if constexpr (type_traits::is_default_properties_type_v <edge_properties_type>)
397+ if constexpr (type_traits::c_empty_properties <edge_properties_type>)
398398 return this ->_impl .get_edges (first_id, second_id);
399399 else
400400 return this ->_impl .get_edges (first_id, second_id, this ->_edge_properties );
@@ -408,7 +408,7 @@ class graph final {
408408
409409 gl_attr_force_inline void remove_edge (const edge_type& edge) {
410410 this ->_verify_edge (edge);
411- if constexpr (not type_traits::is_default_properties_type_v <edge_properties_type>)
411+ if constexpr (type_traits::c_non_empty_properties <edge_properties_type>)
412412 this ->_edge_properties .erase (this ->_edge_properties .begin () + edge.id ());
413413 this ->_impl .remove_edge (edge);
414414 this ->_n_unique_edges --;
@@ -418,7 +418,7 @@ class graph final {
418418 const auto removed_edge_ids = this ->_impl .remove_edges (edges);
419419 this ->_n_unique_edges -= removed_edge_ids.size ();
420420
421- if constexpr (not type_traits::is_default_properties_type_v <edge_properties_type>) {
421+ if constexpr (type_traits::c_non_empty_properties <edge_properties_type>) {
422422 // IDs are sorted and do not contain duplicates
423423 for (const auto edge_id : std::views::reverse (removed_edge_ids))
424424 this ->_edge_properties .erase (this ->_edge_properties .begin () + edge_id);
@@ -427,7 +427,7 @@ class graph final {
427427
428428 [[nodiscard]] inline auto adjacent_edges (const types::id_type vertex_id) const {
429429 this ->_verify_vertex_id (vertex_id);
430- if constexpr (type_traits::is_default_properties_type_v <edge_properties_type>)
430+ if constexpr (type_traits::c_empty_properties <edge_properties_type>)
431431 return this ->_impl .adjacent_edges (vertex_id);
432432 else
433433 return this ->_impl .adjacent_edges (vertex_id, this ->_edge_properties );
@@ -525,10 +525,10 @@ class graph final {
525525 this ->_n_vertices --;
526526 this ->_n_unique_edges -= removed_edge_ids.size ();
527527
528- if constexpr (not type_traits::is_default_properties_type_v <vertex_properties_type>)
528+ if constexpr (type_traits::c_non_empty_properties <vertex_properties_type>)
529529 this ->_vertex_properties .erase (this ->_vertex_properties .begin () + vertex_id);
530530
531- if constexpr (not type_traits::is_default_properties_type_v <edge_properties_type>) {
531+ if constexpr (type_traits::c_non_empty_properties <edge_properties_type>) {
532532 // IDs are sorted and do not contain duplicates
533533 for (const auto & edge_id : std::views::reverse (removed_edge_ids))
534534 this ->_edge_properties .erase (this ->_edge_properties .begin () + edge_id);
@@ -547,7 +547,7 @@ class graph final {
547547
548548 for (const auto & vertex : this ->vertices ()) {
549549 os << " - " << vertex << " \n adjacent edges:\n " ;
550- for (const auto & edge : this ->_impl . adjacent_edges (vertex.id ()))
550+ for (const auto & edge : this ->adjacent_edges (vertex.id ()))
551551 os << " \t - " << edge << ' \n ' ;
552552 }
553553 }
@@ -559,7 +559,7 @@ class graph final {
559559
560560 for (const auto & vertex : this ->vertices ()) {
561561 os << " - " << vertex << " :" ;
562- for (const auto & edge : this ->_impl . adjacent_edges (vertex.id ()))
562+ for (const auto & edge : this ->adjacent_edges (vertex.id ()))
563563 os << ' ' << edge;
564564 os << ' \n ' ;
565565 }
@@ -584,15 +584,15 @@ class graph final {
584584 if constexpr (type_traits::c_writable<typename vertex_type::properties_type>)
585585 if (with_vertex_properties)
586586 for (const auto & vertex : this ->vertices ())
587- os << vertex._properties << ' \n ' ;
587+ os << vertex.properties () << ' \n ' ;
588588
589589 if constexpr (type_traits::c_writable<typename edge_type::properties_type>) {
590590 if (with_edge_properties) {
591591 const auto print_incident_edges = [this , &os](const types::id_type vertex_id) {
592- for (const auto & edge : this ->_impl . adjacent_edges (vertex_id)) {
592+ for (const auto & edge : this ->adjacent_edges (vertex_id)) {
593593 if (edge.first () != vertex_id)
594594 continue ; // vertex is not the source
595- os << edge.first () << ' ' << edge.second () << ' ' << edge._properties
595+ os << edge.first () << ' ' << edge.second () << ' ' << edge.properties ()
596596 << ' \n ' ;
597597 }
598598 };
@@ -605,7 +605,7 @@ class graph final {
605605 }
606606
607607 const auto print_incident_edges = [this , &os](const types::id_type vertex_id) {
608- for (const auto & edge : this ->_impl . adjacent_edges (vertex_id)) {
608+ for (const auto & edge : this ->adjacent_edges (vertex_id)) {
609609 if (edge.first () != vertex_id)
610610 continue ; // vertex is not the source
611611 os << edge.first () << ' ' << edge.second () << ' \n ' ;
0 commit comments