From 3898097d8de681dc02cdaf8799686f357304238a Mon Sep 17 00:00:00 2001 From: Phil Ratzloff Date: Tue, 3 Sep 2024 19:58:26 -0400 Subject: [PATCH] Additional std:: types and functions to graph_using.hpp The main motivation is to allow copy/paste into the paper without requiring editing of any std:: concepts or types Additionall entries added for convenience. Fixed error where std::invoke_result was used instead of std::invoke_result_t in compressed_graph --- .../algorithm/bellman_ford_shortest_paths.hpp | 51 +++++++-------- include/graph/algorithm/dijkstra_clrs.hpp | 2 +- .../algorithm/dijkstra_shortest_paths.hpp | 32 +++++---- .../algorithm/experimental/co_dijkstra.hpp | 8 +-- .../experimental/visitor_dijkstra.hpp | 6 +- include/graph/container/compressed_graph.hpp | 54 +++++++-------- include/graph/detail/graph_cpo.hpp | 65 ++++++++++--------- include/graph/detail/graph_using.hpp | 27 ++++++-- include/graph/edgelist.hpp | 2 +- include/graph/graph.hpp | 2 +- include/graph/views/breadth_first_search.hpp | 16 ++--- include/graph/views/depth_first_search.hpp | 12 ++-- include/graph/views/edgelist.hpp | 12 ++-- include/graph/views/incidence.hpp | 8 +-- include/graph/views/neighbors.hpp | 6 +- include/graph/views/vertexlist.hpp | 12 ++-- 16 files changed, 161 insertions(+), 154 deletions(-) diff --git a/include/graph/algorithm/bellman_ford_shortest_paths.hpp b/include/graph/algorithm/bellman_ford_shortest_paths.hpp index 28ce906..292056d 100644 --- a/include/graph/algorithm/bellman_ford_shortest_paths.hpp +++ b/include/graph/algorithm/bellman_ford_shortest_paths.hpp @@ -37,18 +37,12 @@ class bellman_visitor_base { // Visitor Functions public: - // vertex visitor functions - //constexpr void on_initialize_vertex(vertex_desc_type&& vdesc) {} - //constexpr void on_discover_vertex(vertex_desc_type&& vdesc) {} - //constexpr void on_examine_vertex(vertex_desc_type&& vdesc) {} - //constexpr void on_finish_vertex(vertex_desc_type&& vdesc) {} - // edge visitor functions - constexpr void on_examine_edge(sourced_edge_desc_type&& edesc) {} - constexpr void on_edge_relaxed(sourced_edge_desc_type&& edesc) {} - constexpr void on_edge_not_relaxed(sourced_edge_desc_type&& edesc) {} - constexpr void on_edge_minimized(sourced_edge_desc_type&& edesc) {} - constexpr void on_edge_not_minimized(sourced_edge_desc_type&& edesc) {} + constexpr void on_examine_edge(const sourced_edge_desc_type& edesc) {} + constexpr void on_edge_relaxed(const sourced_edge_desc_type& edesc) {} + constexpr void on_edge_not_relaxed(const sourced_edge_desc_type& edesc) {} + constexpr void on_edge_minimized(const sourced_edge_desc_type& edesc) {} + constexpr void on_edge_not_minimized(const sourced_edge_desc_type& edesc) {} }; template @@ -86,10 +80,10 @@ concept bellman_visitor = //is_arithmetic && */ template requires output_iterator> -void find_negative_cycle(G& g, - const Predecessors& predecessor, - const std::optional>& cycle_vertex_id, - OutputIterator out_cycle) { +void find_negative_cycle(G& g, + const Predecessors& predecessor, + const optional>& cycle_vertex_id, + OutputIterator out_cycle) { // Does a negative weight cycle exist? if (cycle_vertex_id.has_value()) { vertex_id_t uid = cycle_vertex_id.value(); @@ -137,7 +131,7 @@ template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = bellman_visitor_base, class Compare = less>, class Combine = plus>> @@ -148,7 +142,7 @@ requires convertible_to, vertex_id_t> && // sized_range && // basic_edge_weight_function, Compare, Combine> // && bellman_visitor -[[nodiscard]] std::optional> bellman_ford_shortest_paths( +[[nodiscard]] optional> bellman_ford_shortest_paths( G& g, const Sources& sources, Distances& distances, @@ -160,7 +154,7 @@ requires convertible_to, vertex_id_t> && // using id_type = vertex_id_t; using DistanceValue = range_value_t; using weight_type = invoke_result_t>; - using return_type = std::optional>; + using return_type = optional>; // relxing the target is the function of reducing the distance from the source to the target auto relax_target = [&g, &predecessor, &distances, &compare, &combine] // @@ -240,7 +234,7 @@ requires convertible_to, vertex_id_t> && // template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = bellman_visitor_base, class Compare = less>, class Combine = plus>> @@ -250,7 +244,7 @@ requires is_arithmetic_v> && // sized_range && // basic_edge_weight_function, Compare, Combine> // && bellman_visitor -[[nodiscard]] std::optional> bellman_ford_shortest_paths( +[[nodiscard]] optional> bellman_ford_shortest_paths( G& g, const vertex_id_t source, Distances& distances, @@ -265,7 +259,7 @@ requires is_arithmetic_v> && // /** - * @brief Shortest distnaces from a single source using Bellman-Ford's single-source shortest paths + * @brief Shortest distances from a single source using Bellman-Ford's single-source shortest paths * algorithm with a visitor. * * This is identical to bellman_ford_shortest_paths() except that it does not require a predecessors range. @@ -297,7 +291,7 @@ requires is_arithmetic_v> && // template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = bellman_visitor_base, class Compare = less>, class Combine = plus>> @@ -306,7 +300,7 @@ requires convertible_to, vertex_id_t> && // sized_range && // basic_edge_weight_function, Compare, Combine> //&& bellman_visitor -[[nodiscard]] std::optional> bellman_ford_shortest_distances( +[[nodiscard]] optional> bellman_ford_shortest_distances( G& g, const Sources& sources, Distances& distances, @@ -315,13 +309,12 @@ requires convertible_to, vertex_id_t> && // Compare&& compare = less>(), Combine&& combine = plus>()) { return bellman_ford_shortest_paths(g, sources, distances, _null_predecessors, forward(weight), - std::forward(visitor), std::forward(compare), - std::forward(combine)); + forward(visitor), forward(compare), forward(combine)); } template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = bellman_visitor_base, class Compare = less>, class Combine = plus>> @@ -329,7 +322,7 @@ requires is_arithmetic_v> && // sized_range && // basic_edge_weight_function, Compare, Combine> //&& bellman_visitor -[[nodiscard]] std::optional> bellman_ford_shortest_distances( +[[nodiscard]] optional> bellman_ford_shortest_distances( G& g, const vertex_id_t source, Distances& distances, @@ -338,8 +331,8 @@ requires is_arithmetic_v> && // Compare&& compare = less>(), Combine&& combine = plus>()) { return bellman_ford_shortest_paths(g, subrange(&source, (&source + 1)), distances, _null_predecessors, - forward(weight), std::forward(visitor), - std::forward(compare), std::forward(combine)); + forward(weight), forward(visitor), forward(compare), + forward(combine)); } } // namespace graph diff --git a/include/graph/algorithm/dijkstra_clrs.hpp b/include/graph/algorithm/dijkstra_clrs.hpp index 6d0cc52..c814a9e 100644 --- a/include/graph/algorithm/dijkstra_clrs.hpp +++ b/include/graph/algorithm/dijkstra_clrs.hpp @@ -83,7 +83,7 @@ constexpr auto print_types(Ts...) { template (edge_reference_t)>> + class WF = function(edge_reference_t)>> requires random_access_range> && // integral> && // is_arithmetic_v> && // diff --git a/include/graph/algorithm/dijkstra_shortest_paths.hpp b/include/graph/algorithm/dijkstra_shortest_paths.hpp index c409f55..b4e0523 100644 --- a/include/graph/algorithm/dijkstra_shortest_paths.hpp +++ b/include/graph/algorithm/dijkstra_shortest_paths.hpp @@ -37,15 +37,15 @@ class dijkstra_visitor_base { // Visitor Functions public: // vertex visitor functions - constexpr void on_initialize_vertex(vertex_desc_type&& vdesc) {} - constexpr void on_discover_vertex(vertex_desc_type&& vdesc) {} - constexpr void on_examine_vertex(vertex_desc_type&& vdesc) {} - constexpr void on_finish_vertex(vertex_desc_type&& vdesc) {} + constexpr void on_initialize_vertex(const vertex_desc_type& vdesc) {} + constexpr void on_discover_vertex(const vertex_desc_type& vdesc) {} + constexpr void on_examine_vertex(const vertex_desc_type& vdesc) {} + constexpr void on_finish_vertex(const vertex_desc_type& vdesc) {} // edge visitor functions - constexpr void on_examine_edge(sourced_edge_desc_type&& edesc) {} - constexpr void on_edge_relaxed(sourced_edge_desc_type&& edesc) {} - constexpr void on_edge_not_relaxed(sourced_edge_desc_type&& edesc) {} + constexpr void on_examine_edge(const sourced_edge_desc_type& edesc) {} + constexpr void on_edge_relaxed(const sourced_edge_desc_type& edesc) {} + constexpr void on_edge_not_relaxed(const sourced_edge_desc_type& edesc) {} }; template @@ -97,7 +97,7 @@ template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = dijkstra_visitor_base, class Compare = less>, class Combine = plus>> @@ -188,7 +188,7 @@ void dijkstra_shortest_paths( visitor.on_examine_edge({uid, vid, uv}); // Negative weights are not allowed for Dijkstra's algorithm - if constexpr (std::is_signed_v) { + if constexpr (is_signed_v) { if (w < zero) { throw std::out_of_range( fmt::format("dijkstra_shortest_paths: invalid negative edge weight of '{}' encountered", w)); @@ -230,7 +230,7 @@ void dijkstra_shortest_paths( template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = dijkstra_visitor_base, class Compare = less>, class Combine = plus>> @@ -282,7 +282,7 @@ void dijkstra_shortest_paths( template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = dijkstra_visitor_base, class Compare = less>, class Combine = plus>> @@ -299,14 +299,13 @@ void dijkstra_shortest_distances( Visitor&& visitor = dijkstra_visitor_base(), Compare&& compare = less>(), Combine&& combine = plus>()) { - dijkstra_shortest_paths(g, sources, distances, _null_predecessors, forward(weight), - std::forward(visitor), std::forward(compare), - std::forward(combine)); + dijkstra_shortest_paths(g, sources, distances, _null_predecessors, forward(weight), forward(visitor), + forward(compare), forward(combine)); } template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Visitor = dijkstra_visitor_base, class Compare = less>, class Combine = plus>> @@ -323,8 +322,7 @@ void dijkstra_shortest_distances( Compare&& compare = less>(), Combine&& combine = plus>()) { dijkstra_shortest_paths(g, subrange(&source, (&source + 1)), distances, _null_predecessors, forward(weight), - std::forward(visitor), std::forward(compare), - std::forward(combine)); + forward(visitor), forward(compare), forward(combine)); } } // namespace graph diff --git a/include/graph/algorithm/experimental/co_dijkstra.hpp b/include/graph/algorithm/experimental/co_dijkstra.hpp index bbab5c8..c51ad86 100644 --- a/include/graph/algorithm/experimental/co_dijkstra.hpp +++ b/include/graph/algorithm/experimental/co_dijkstra.hpp @@ -82,7 +82,7 @@ template >, class Combine = plus>, - class WF = std::function(edge_reference_t)>> + class WF = function(edge_reference_t)>> requires convertible_to, vertex_id_t> && // is_arithmetic_v> && // convertible_to, range_value_t> && // @@ -168,7 +168,7 @@ Generator> co_dijkstra( dijkstra_yield_edge(dijkstra_events::examine_edge, uid, vid, uv); // Negative weights are not allowed for Dijkstra's algorithm - if constexpr (std::is_signed_v) { + if constexpr (is_signed_v) { if (w < zero) { throw graph_error("co_dijkstra: negative edge weight"); } @@ -233,10 +233,10 @@ template >, class Combine = plus>, - class WF = std::function(edge_reference_t)>, + class WF = function(edge_reference_t)>, _queueable Queue = std::priority_queue, std::vector>, - std::greater>>> + greater>>> requires is_arithmetic_v> && // convertible_to, range_value_t> && // basic_edge_weight_function, Compare, Combine> diff --git a/include/graph/algorithm/experimental/visitor_dijkstra.hpp b/include/graph/algorithm/experimental/visitor_dijkstra.hpp index 4181377..227dddd 100644 --- a/include/graph/algorithm/experimental/visitor_dijkstra.hpp +++ b/include/graph/algorithm/experimental/visitor_dijkstra.hpp @@ -141,7 +141,7 @@ template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Compare = less>, class Combine = plus> //queueable Que = _dijkstra_queue // not used @@ -241,7 +241,7 @@ void dijkstra_with_visitor( visitor.on_examine_edge({uid, vid, uv}); // Negative weights are not allowed for Dijkstra's algorithm - if constexpr (std::is_signed_v) { + if constexpr (is_signed_v) { if (w < zero) { throw graph_error("dijkstra_with_visitor: negative edge weight"); } @@ -303,7 +303,7 @@ template (edge_reference_t)>, + class WF = function(edge_reference_t)>, class Compare = less>, class Combine = plus>, queueable Que = _dijkstra_queue> diff --git a/include/graph/container/compressed_graph.hpp b/include/graph/container/compressed_graph.hpp index db0d832..3794699 100644 --- a/include/graph/container/compressed_graph.hpp +++ b/include/graph/container/compressed_graph.hpp @@ -47,7 +47,7 @@ namespace graph::container { * @return A @c pair with the max vertex id used and the number of edges scanned. */ template -requires copyable_edge>, VId, EV> +requires copyable_edge>, VId, EV> constexpr auto max_vertex_id(const ERng& erng, const EProj& eprojection) { size_t edge_count = 0; VId max_id = 0; @@ -167,7 +167,7 @@ class csr_row_values { constexpr void swap(csr_row_values& other) noexcept { swap(v_, other.v_); } template - //requires views::copyable_vertex>, VId, VV> + //requires views::copyable_vertex>, VId, VV> constexpr void load_row_values(const VRng& vrng, VProj projection, size_type vertex_count) { if constexpr (sized_range) vertex_count = max(vertex_count, size(vrng)); @@ -185,7 +185,7 @@ class csr_row_values { } template - //requires views::copyable_vertex>, VId, VV> + //requires views::copyable_vertex>, VId, VV> constexpr void load_row_values(VRng&& vrng, VProj projection, size_type vertex_count) { if constexpr (sized_range) vertex_count = max(vertex_count, std::ranges::size(vrng)); @@ -446,7 +446,7 @@ class compressed_graph_base * @param alloc Allocator to use for internal containers */ template - //requires copyable_edge>, VId, EV> && // + //requires copyable_edge>, VId, EV> && // // convertible_to, VId> constexpr compressed_graph_base(const ERng& erng, EProj eprojection = {}, @@ -485,8 +485,8 @@ class compressed_graph_base class EProj = identity, class VProj = identity> requires convertible_to, VId> - //requires copyable_edge>, VId, EV> && - // copyable_vertex>, VId, VV> + //requires copyable_edge>, VId, EV> && + // copyable_vertex>, VId, VV> constexpr compressed_graph_base(const ERng& erng, const VRng& vrng, EProj eprojection = {}, // eproj(eval) -> {source_id,target_id [,value]} @@ -553,7 +553,7 @@ class compressed_graph_base * @param vprojection Projection function for @c vrng values */ template - //requires views::copyable_vertex>, VId, VV> + //requires views::copyable_vertex>, VId, VV> constexpr void load_vertices(const VRng& vrng, VProj vprojection, size_type vertex_count = 0) { row_values_base::load_row_values(vrng, vprojection, max(vertex_count, size(vrng))); } @@ -572,7 +572,7 @@ class compressed_graph_base * @param vprojection Projection function for @c vrng values */ template - //requires views::copyable_vertex>, VId, VV> + //requires views::copyable_vertex>, VId, VV> constexpr void load_vertices(VRng& vrng, VProj vprojection = {}, size_type vertex_count = 0) { row_values_base::load_row_values(vrng, vprojection, max(vertex_count, size(vrng))); } @@ -617,7 +617,7 @@ class compressed_graph_base * edge range. */ template - //requires views::copyable_edge>, VId, EV> + //requires views::copyable_edge>, VId, EV> constexpr void load_edges(ERng&& erng, EProj eprojection = {}, size_type vertex_count = 0, size_type edge_count = 0) { // should only be loading into an empty graph assert(row_index_.empty() && col_index_.empty() && static_cast(*this).empty()); @@ -631,8 +631,8 @@ class compressed_graph_base // We can get the last vertex id from the list because erng is required to be ordered by // the source id. It's possible a target_id could have a larger id also, which is taken // care of at the end of this function. - vertex_count = max(vertex_count, - static_cast(last_erng_id(erng, eprojection) + 1)); // +1 for zero-based index + vertex_count = + max(vertex_count, static_cast(last_erng_id(erng, eprojection) + 1)); // +1 for zero-based index reserve_vertices(vertex_count); // Eval number of input rows and reserve space for the edges, if possible @@ -669,7 +669,7 @@ class compressed_graph_base // The only diff with this and ERng&& is v_.push_back vs. v_.emplace_back template - //requires views::copyable_edge>, VId, EV> + //requires views::copyable_edge>, VId, EV> constexpr void load_edges(const ERng& erng, EProj eprojection = {}, size_type vertex_count = 0, size_type edge_count = 0) { // should only be loading into an empty graph @@ -684,8 +684,8 @@ class compressed_graph_base // We can get the last vertex id from the list because erng is required to be ordered by // the source id. It's possible a target_id could have a larger id also, which is taken // care of at the end of this function. - vertex_count = max(vertex_count, - static_cast(last_erng_id(erng, eprojection) + 1)); // +1 for zero-based index + vertex_count = + max(vertex_count, static_cast(last_erng_id(erng, eprojection) + 1)); // +1 for zero-based index reserve_vertices(vertex_count); // Eval number of input rows and reserve space for the edges, if possible @@ -752,8 +752,8 @@ class compressed_graph_base class EProj = identity, class VProj = identity> requires convertible_to, VId> - //requires views::copyable_edge>, VId, EV> && - // views::copyable_vertex>, VId, VV> + //requires views::copyable_edge>, VId, EV> && + // views::copyable_vertex>, VId, VV> constexpr void load(const ERng& erng, const VRng& vrng, EProj eprojection = {}, VProj vprojection = {}) { load_edges(erng, eprojection); load_vertices(vrng, vprojection); // load the values @@ -951,7 +951,7 @@ class compressed_graph : public compressed_graph_base - requires copyable_edge>, VId, EV> && + requires copyable_edge>, VId, EV> && convertible_to, VId> constexpr compressed_graph(const ERng& erng, EProj eprojection, @@ -960,7 +960,7 @@ class compressed_graph : public compressed_graph_base - requires copyable_edge>, VId, EV> && + requires copyable_edge>, VId, EV> && convertible_to, VId> constexpr compressed_graph(const graph_value_type& value, const ERng& erng, @@ -970,7 +970,7 @@ class compressed_graph : public compressed_graph_base - requires copyable_edge>, VId, EV> && + requires copyable_edge>, VId, EV> && convertible_to, VId> constexpr compressed_graph(graph_value_type&& value, const ERng& erng, @@ -988,8 +988,8 @@ class compressed_graph : public compressed_graph_base - requires copyable_edge>, VId, EV> && - copyable_vertex>, VId, VV> && + requires copyable_edge>, VId, EV> && + copyable_vertex>, VId, VV> && convertible_to, VId> constexpr compressed_graph(const ERng& erng, const VRng& vrng, @@ -1004,8 +1004,8 @@ class compressed_graph : public compressed_graph_base - requires copyable_edge>, VId, EV> && - copyable_vertex>, VId, VV> && + requires copyable_edge>, VId, EV> && + copyable_vertex>, VId, VV> && convertible_to, VId> constexpr compressed_graph(const graph_value_type& value, const ERng& erng, @@ -1021,8 +1021,8 @@ class compressed_graph : public compressed_graph_base - requires copyable_edge>, VId, EV> && - copyable_vertex>, VId, VV> && + requires copyable_edge>, VId, EV> && + copyable_vertex>, VId, VV> && convertible_to, VId> constexpr compressed_graph(graph_value_type&& value, const ERng& erng, @@ -1095,8 +1095,8 @@ class compressed_graph class EProj = identity, class VProj = identity, forward_range PartRng = std::vector> - requires copyable_edge>, VId, EV> && - copyable_vertex>, VId, VV> && + requires copyable_edge>, VId, EV> && + copyable_vertex>, VId, VV> && convertible_to, VId> constexpr compressed_graph(const ERng& erng, const VRng& vrng, diff --git a/include/graph/detail/graph_cpo.hpp b/include/graph/detail/graph_cpo.hpp index 5141f3b..cc5b270 100644 --- a/include/graph/detail/graph_cpo.hpp +++ b/include/graph/detail/graph_cpo.hpp @@ -18,7 +18,8 @@ using std::_Choice_t; // Very similar (identical?) to std::_Fake_copy_init in msvc. struct _Decay_copy final { template - constexpr std::decay_t<_Tp> operator()(_Tp&& __t) const noexcept(std::is_nothrow_convertible_v<_Tp, std::decay_t<_Tp>>) { + constexpr std::decay_t<_Tp> operator()(_Tp&& __t) const + noexcept(std::is_nothrow_convertible_v<_Tp, std::decay_t<_Tp>>) { return std::forward<_Tp>(__t); } } inline constexpr _Fake_copy_init{}; @@ -159,7 +160,7 @@ using graph_reference_t = std::add_lvalue_reference; * @tparam G The graph type */ template -struct define_adjacency_matrix : public std::false_type {}; // specialized for graph container +struct define_adjacency_matrix : public false_type {}; // specialized for graph container template struct is_adjacency_matrix : public define_adjacency_matrix {}; @@ -205,7 +206,7 @@ namespace _Vertices { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval<_G>().vertices()))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -315,7 +316,7 @@ namespace _Vertex_id { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>()->vertex_id(declval<_G>())))}; @@ -490,7 +491,7 @@ namespace _Find_vertex { template [[nodiscard]] static consteval _Choice_t<_St> _Choose() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_member<_G>) { return {_St::_Member, noexcept(_Fake_copy_init(declval<_G>().find_vertex(declval>())))}; } else if constexpr (_Has_ADL<_G>) { @@ -591,7 +592,7 @@ namespace _Edges { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(edges(declval<_G>(), declval>())))}; // intentional ADL @@ -608,7 +609,7 @@ namespace _Edges { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>().edges(declval<_G>())))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -752,7 +753,7 @@ namespace _NumEdges { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval<_G>().num_edges()))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -861,7 +862,7 @@ namespace _Target_id { template [[nodiscard]] static consteval _Choice_t<_St_adjl_ref> _Choose_adjl_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjl_ref_member<_G>) { return {_St_adjl_ref::_Member, @@ -890,7 +891,7 @@ namespace _Target_id { template [[nodiscard]] static consteval _Choice_t<_St_edgl_ref> _Choose_edgl_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_E>); + //static_assert(is_lvalue_reference_v<_E>); if constexpr (_Has_edgl_ref_member<_E>) { return {_St_edgl_ref::_Member, noexcept(_Fake_copy_init(declval<_E&>().target_id()))}; @@ -1050,7 +1051,7 @@ namespace _Source_id { template [[nodiscard]] static consteval _Choice_t<_St_adjl_ref> _Choose_adjl_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjl_ref_member<_G>) { return {_St_adjl_ref::_Member, noexcept(_Fake_copy_init(declval>().source_id(declval<_G>())))}; @@ -1070,7 +1071,7 @@ namespace _Source_id { template [[nodiscard]] static consteval _Choice_t<_St_edgl_ref> _Choose_edgl_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_E>); + //static_assert(is_lvalue_reference_v<_E>); if constexpr (_Has_edgl_ref_member<_E>) { return {_St_edgl_ref::_Member, noexcept(_Fake_copy_init(declval<_E>().source_id()))}; } else if constexpr (_Has_edgl_ref_ADL<_E>) { @@ -1196,7 +1197,7 @@ namespace _Target { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G>) { return {_St_ref::_Non_member, @@ -1279,7 +1280,7 @@ namespace _Source { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(source(declval<_G>(), declval>())))}; // intentional ADL @@ -1384,7 +1385,7 @@ namespace _Find_vertex_edge { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>().find_vertex_edge( declval<_G>(), declval>())))}; @@ -1407,7 +1408,7 @@ namespace _Find_vertex_edge { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(find_vertex_edge(declval<_G>(), declval>(), @@ -1526,7 +1527,7 @@ namespace _Contains_edge { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(contains_edge(declval<_G>(), declval>(), @@ -1631,7 +1632,7 @@ namespace _Partition_id { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(partition_id(declval<_G>(), declval>())))}; // intentional ADL @@ -1647,7 +1648,7 @@ namespace _Partition_id { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>().partition_id(declval<_G>())))}; @@ -1777,7 +1778,7 @@ namespace _NumVertices { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval<_G>().num_vertices()))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -1794,7 +1795,7 @@ namespace _NumVertices { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return { _St_id::_Non_member, @@ -1919,7 +1920,7 @@ namespace _Degree { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(degree(declval<_G>(), declval>())))}; // intentional ADL @@ -1936,7 +1937,7 @@ namespace _Degree { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>().degree(declval<_G>())))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -1975,7 +1976,7 @@ namespace _Degree { if constexpr (_Strat_ref == _St_ref::_Member) { return u.degree(__g); } else if constexpr (_Strat_ref == _St_ref::_Non_member) { - return degree(__g, u); // intentional ADL + return degree(__g, u); // intentional ADL } else if constexpr (_Strat_ref == _St_ref::_Auto_eval) { return size(edges(__g, u)); // default impl } else { @@ -2003,7 +2004,7 @@ namespace _Degree { constexpr _St_id _Strat_id = _Choice_id<_G&>._Strategy; if constexpr (_Strat_id == _St_id::_Non_member) { - return degree(__g, uid); // intentional ADL + return degree(__g, uid); // intentional ADL } else if constexpr (_Strat_id == _St_id::_Auto_eval) { return size(edges(__g, uid)); // default impl } else { @@ -2047,7 +2048,7 @@ namespace _Vertex_value { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>().vertex_value( declval>())))}; @@ -2150,7 +2151,7 @@ namespace _Edge_value { template [[nodiscard]] static consteval _Choice_t<_St_adjl_ref> _Choose_adjl_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjl_ref_member<_G>) { return { _St_adjl_ref::_Member, @@ -2174,7 +2175,7 @@ namespace _Edge_value { template [[nodiscard]] static consteval _Choice_t<_St_edgl_ref> _Choose_edgl_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_E>); + //static_assert(is_lvalue_reference_v<_E>); if constexpr (_Has_edgl_ref_member<_E>) { return {_St_edgl_ref::_Member, noexcept(_Fake_copy_init(declval<_E>().edge_value()))}; } else if constexpr (_Has_edgl_ref_ADL<_E>) { @@ -2307,7 +2308,7 @@ namespace _Graph_value { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval>().graph_value()))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -2384,7 +2385,7 @@ namespace _Num_partitions { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval<_G>().num_partitions()))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -2483,7 +2484,7 @@ namespace _HasEdge { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_member<_G>) { return {_St_ref::_Member, noexcept(_Fake_copy_init(declval<_G>().has_edge()))}; } else if constexpr (_Has_ref_ADL<_G>) { @@ -2501,7 +2502,7 @@ namespace _HasEdge { //template //[[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - // static_assert(std::is_lvalue_reference_v<_G>); + // static_assert(is_lvalue_reference_v<_G>); // if constexpr (_Has_id_ADL<_G>) { // return { // _St_id::_Non_member, diff --git a/include/graph/detail/graph_using.hpp b/include/graph/detail/graph_using.hpp index d5e1d20..f8b085f 100644 --- a/include/graph/detail/graph_using.hpp +++ b/include/graph/detail/graph_using.hpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include namespace graph { // Containers are not included to avoid potential conflicts: vector, list, string, etc. @@ -14,14 +16,28 @@ using std::tuple_element_t; using std::tuple_size_v; using std::reference_wrapper; using std::forward_iterator_tag; +using std::declval; + +// functional types using std::plus; using std::less; -using std::declval; +using std::greater; +using std::identity; +using std::function; +using std::invoke; + +// optional types +using std::optional; // type traits using std::is_arithmetic_v; using std::is_convertible_v; using std::is_same_v; +using std::is_invocable_v; +using std::is_arithmetic_v; +using std::is_void_v; +using std::is_lvalue_reference_v; +using std::is_signed_v; using std::remove_cv_t; using std::remove_const_t; @@ -29,15 +45,15 @@ using std::remove_volatile_t; using std::remove_reference_t; using std::remove_pointer_t; using std::remove_cvref_t; -using std::is_arithmetic_v; -using std::is_void_v; +using std::invoke_result_t; + +using std::false_type; +using std::true_type; // concepts using std::same_as; using std::convertible_to; using std::integral; -using std::invoke_result; -using std::invoke_result_t; using std::invocable; using std::regular_invocable; @@ -61,7 +77,6 @@ using std::random_access_iterator; using std::contiguous_iterator; // range types -using std::identity; using std::ranges::subrange; using std::ranges::iterator_t; diff --git a/include/graph/edgelist.hpp b/include/graph/edgelist.hpp index 42803c2..0e7e46f 100644 --- a/include/graph/edgelist.hpp +++ b/include/graph/edgelist.hpp @@ -107,7 +107,7 @@ namespace edgelist { }; template - struct is_directed : public std::false_type {}; // specialized for graph container + struct is_directed : public false_type {}; // specialized for graph container template inline constexpr bool is_directed_v = is_directed::value; diff --git a/include/graph/graph.hpp b/include/graph/graph.hpp index 40b46b3..4f410d9 100644 --- a/include/graph/graph.hpp +++ b/include/graph/graph.hpp @@ -374,7 +374,7 @@ concept has_contains_edge = requires(G&& g, vertex_id_t uid, vertex_id_t v */ template -struct define_unordered_edge : public std::false_type {}; // specialized for graph container edge +struct define_unordered_edge : public false_type {}; // specialized for graph container edge template // For exposition only concept unordered_edge = basic_sourced_edge && define_unordered_edge::value; diff --git a/include/graph/views/breadth_first_search.hpp b/include/graph/views/breadth_first_search.hpp index 6c0eb98..233f887 100644 --- a/include/graph/views/breadth_first_search.hpp +++ b/include/graph/views/breadth_first_search.hpp @@ -209,7 +209,7 @@ class vertices_breadth_first_search_view : public bfs_base { using bfs_range_type = vertices_breadth_first_search_view; using vertex_value_func = remove_reference_t; - using vertex_value_type = std::invoke_result_t; + using vertex_value_type = invoke_result_t; public: vertices_breadth_first_search_view(graph_type& g, @@ -455,7 +455,7 @@ class edges_breadth_first_search_view : public bfs_base { using bfs_range_type = edges_breadth_first_search_view; using edge_value_func = remove_reference_t; - using edge_value_type = std::invoke_result_t; + using edge_value_type = invoke_result_t; public: edges_breadth_first_search_view(G& g, vertex_id_type seed, const EVF& value_fn, const Alloc& alloc = Alloc()) @@ -717,7 +717,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G, _Alloc>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(vertices_breadth_first_search(declval<_G>(), declval>(), @@ -735,7 +735,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref_vvf> _Choose_ref_vvf() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_vvf_ADL<_G, _VVF, _Alloc>) { return {_St_ref_vvf::_Non_member, noexcept(_Fake_copy_init(vertices_breadth_first_search( declval<_G>(), declval>(), declval<_VVF>(), @@ -866,7 +866,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G, _Alloc>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(edges_breadth_first_search(declval<_G>(), declval>(), @@ -884,7 +884,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref_evf> _Choose_ref_evf() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_evf_ADL<_G, _EVF, _Alloc>) { return {_St_ref_evf::_Non_member, noexcept(_Fake_copy_init(edges_breadth_first_search( declval<_G>(), declval>(), declval<_EVF>(), @@ -1019,7 +1019,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G, _Alloc>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(sourced_edges_breadth_first_search(declval<_G>(), declval>(), @@ -1037,7 +1037,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref_evf> _Choose_ref_evf() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_evf_ADL<_G, _EVF, _Alloc>) { return {_St_ref_evf::_Non_member, noexcept(_Fake_copy_init(sourced_edges_breadth_first_search( declval<_G>(), declval>(), declval<_EVF>(), diff --git a/include/graph/views/depth_first_search.hpp b/include/graph/views/depth_first_search.hpp index c3cb946..73ba909 100644 --- a/include/graph/views/depth_first_search.hpp +++ b/include/graph/views/depth_first_search.hpp @@ -685,7 +685,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G, _Alloc>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(vertices_depth_first_search(declval<_G>(), declval>(), @@ -703,7 +703,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref_vvf> _Choose_ref_vvf() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_vvf_ADL<_G, _VVF, _Alloc>) { return {_St_ref_vvf::_Non_member, noexcept(_Fake_copy_init(vertices_depth_first_search( declval<_G>(), declval>(), declval<_VVF>(), @@ -834,7 +834,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G, _Alloc>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(edges_depth_first_search(declval<_G>(), declval>(), @@ -852,7 +852,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref_evf> _Choose_ref_evf() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_evf_ADL<_G, _EVF, _Alloc>) { return {_St_ref_evf::_Non_member, noexcept(_Fake_copy_init(edges_depth_first_search( declval<_G>(), declval>(), declval<_EVF>(), @@ -987,7 +987,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref> _Choose_ref() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_ADL<_G, _Alloc>) { return {_St_ref::_Non_member, noexcept(_Fake_copy_init(sourced_edges_depth_first_search(declval<_G>(), declval>(), @@ -1005,7 +1005,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_ref_evf> _Choose_ref_evf() noexcept { - //static_assert(std::is_lvalue_reference_v<_G>); + //static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_ref_evf_ADL<_G, _EVF, _Alloc>) { return {_St_ref_evf::_Non_member, noexcept(_Fake_copy_init(sourced_edges_depth_first_search( declval<_G>(), declval>(), declval<_EVF>(), diff --git a/include/graph/views/edgelist.hpp b/include/graph/views/edgelist.hpp index 513fd1b..7749a7b 100644 --- a/include/graph/views/edgelist.hpp +++ b/include/graph/views/edgelist.hpp @@ -174,7 +174,7 @@ class edgelist_iterator : public edgelist_iterator_base { value_.shadow_.edge = &*uvi_; value_.shadow_.value = invoke(*value_fn_, *uvi_); } else { - value_.shadow_ = {vertex_id(*g_, ui_), target_id(*g_, *uvi_), &*uvi_, std::invoke(*value_fn_, *uvi_)}; + value_.shadow_ = {vertex_id(*g_, ui_), target_id(*g_, *uvi_), &*uvi_, invoke(*value_fn_, *uvi_)}; } return value_.value_; } @@ -444,7 +444,7 @@ namespace views { // edgelist(g) template [[nodiscard]] static consteval _Choice_t<_St_adjlist_all> _Choose_all() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjlist_all_ADL<_G>) { return {_St_adjlist_all::_Non_member, noexcept(_Fake_copy_init(edgelist(declval<_G>())))}; // intentional ADL } else if constexpr (_Can_adjlist_all_eval<_G>) { @@ -460,7 +460,7 @@ namespace views { // edgelist(g,evf) template [[nodiscard]] static consteval _Choice_t<_St_adjlist_all> _Choose_all_evf() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjlist_all_evf_ADL<_G, EVF>) { return {_St_adjlist_all::_Non_member, noexcept(_Fake_copy_init(edgelist(declval<_G>(), declval())))}; // intentional ADL @@ -478,7 +478,7 @@ namespace views { // edgelist(g,uid,vid) template [[nodiscard]] static consteval _Choice_t<_St_adjlist_idrng> _Choose_idrng() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjlist_idrng_ADL<_G>) { return {_St_adjlist_idrng::_Non_member, noexcept(_Fake_copy_init(edgelist(declval<_G>(), declval>(), @@ -496,7 +496,7 @@ namespace views { // edgelist(g,uid,vid,evf) template [[nodiscard]] static consteval _Choice_t<_St_adjlist_idrng> _Choose_idrng_evf() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_adjlist_idrng_evf_ADL<_G, EVF>) { return {_St_adjlist_idrng::_Non_member, noexcept(_Fake_copy_init(edgelist(declval<_G>(), declval>(), @@ -515,7 +515,7 @@ namespace views { // edgelist(elr,proj) template [[nodiscard]] static consteval _Choice_t<_St_edgelist_all> _Choose_elr_proj() noexcept { - static_assert(std::is_lvalue_reference_v); + static_assert(is_lvalue_reference_v); if constexpr (_Has_edgelist_all_proj_ADL) { return {_St_edgelist_all::_Non_member, noexcept(_Fake_copy_init(edgelist(declval(), declval())))}; // intentional ADL diff --git a/include/graph/views/incidence.hpp b/include/graph/views/incidence.hpp index 03aaaa2..8014b74 100644 --- a/include/graph/views/incidence.hpp +++ b/include/graph/views/incidence.hpp @@ -44,7 +44,7 @@ class incidence_iterator : _detail::_source_vertex; using edge_type = edge_t; using edge_reference_type = edge_reference_t; - using edge_value_type = std::invoke_result_t; + using edge_value_type = invoke_result_t; using iterator_category = forward_iterator_tag; using value_type = edge_descriptor; @@ -108,7 +108,7 @@ class incidence_iterator : _detail::_source_vertex [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(incidence(declval<_G>(), declval>())))}; // intentional ADL @@ -294,7 +294,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id_evf() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_evf_ADL<_G, EVF>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(incidence(declval<_G>(), declval>(), declval())))}; // intentional ADL diff --git a/include/graph/views/neighbors.hpp b/include/graph/views/neighbors.hpp index b30c3dc..32df90c 100644 --- a/include/graph/views/neighbors.hpp +++ b/include/graph/views/neighbors.hpp @@ -120,7 +120,7 @@ class neighbor_iterator value_.shadow_.target = const_cast(&target(*g_, *iter_)); } value_.shadow_.value = - std::invoke(*value_fn_, *value_.shadow_.target); // 'value' undeclared identifier (.value not in struct?) + invoke(*value_fn_, *value_.shadow_.target); // 'value' undeclared identifier (.value not in struct?) return value_.value_; } @@ -297,7 +297,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(neighbors(declval<_G>(), declval>())))}; // intentional ADL @@ -316,7 +316,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id_vvf() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_id_vvf_ADL<_G, VVF>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(neighbors(declval<_G>(), declval>(), declval())))}; // intentional ADL diff --git a/include/graph/views/vertexlist.hpp b/include/graph/views/vertexlist.hpp index 8d882ec..1f77c8b 100644 --- a/include/graph/views/vertexlist.hpp +++ b/include/graph/views/vertexlist.hpp @@ -38,7 +38,7 @@ class vertexlist_iterator { using vertex_type = vertex_t; using vertex_reference_type = range_reference_t; using vertex_value_func = VVF; - using vertex_value_type = std::invoke_result_t; + using vertex_value_type = invoke_result_t; using iterator_category = forward_iterator_tag; using value_type = vertex_descriptor, vertex_reference_type, vertex_value_type>; @@ -82,7 +82,7 @@ class vertexlist_iterator { constexpr reference operator*() const { value_.shadow_.vertex = &*iter_; if constexpr (!is_void_v) - value_.shadow_.value = std::invoke(*this->value_fn_, *iter_); + value_.shadow_.value = invoke(*this->value_fn_, *iter_); return value_.value_; } @@ -249,7 +249,7 @@ namespace views { // all template [[nodiscard]] static consteval _Choice_t<_St_all> _Choose_all() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_all_ADL<_G>) { return {_St_all::_Non_member, noexcept(_Fake_copy_init(vertexlist(declval<_G>())))}; // intentional ADL @@ -266,7 +266,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_all> _Choose_vvf_all() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_all_vvf_ADL<_G, VVF>) { return {_St_all::_Non_member, @@ -287,7 +287,7 @@ namespace views { // rng template [[nodiscard]] static consteval _Choice_t<_St_rng> _Choose_rng() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_rng_ADL<_G, Rng>) { return {_St_rng::_Non_member, @@ -308,7 +308,7 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_rng> _Choose_vvf_rng() noexcept { - static_assert(std::is_lvalue_reference_v<_G>); + static_assert(is_lvalue_reference_v<_G>); if constexpr (_Has_rng_vvf_ADL<_G, Rng, VVF>) { return {_St_rng::_Non_member, noexcept(_Fake_copy_init(vertexlist(declval<_G>(), declval(),