From 56d585a37f8a3e5509b9970a3774d63d5c6db7eb Mon Sep 17 00:00:00 2001 From: Phil Ratzloff Date: Mon, 22 Jan 2024 20:29:44 -0500 Subject: [PATCH] Remove use of UnCV in incidence.hpp & neighbors.hpp --- include/graph/views/incidence.hpp | 20 ++++++++------------ include/graph/views/neighbors.hpp | 20 ++++++++------------ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/include/graph/views/incidence.hpp b/include/graph/views/incidence.hpp index 76e6393..de5bfd7 100644 --- a/include/graph/views/incidence.hpp +++ b/include/graph/views/incidence.hpp @@ -252,19 +252,19 @@ namespace views { void incidence(); #endif // ^^^ workaround ^^^ - template + template concept _Has_id_ADL = adjacency_list<_G> && requires(_G&& __g, const vertex_id_t<_G>& uid) { { _Fake_copy_init(incidence(__g, uid)) }; // intentional ADL }; - template + template concept _Can_id_eval = adjacency_list<_G>; - template + template concept _Has_id_evf_ADL = adjacency_list<_G> && invocable> && requires(_G&& __g, const vertex_id_t<_G>& uid, const EVF& evf) { { _Fake_copy_init(incidence(__g, uid, evf)) }; // intentional ADL }; - template + template concept _Can_id_evf_eval = adjacency_list<_G> && invocable>; class _Cpo { @@ -275,12 +275,10 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { static_assert(is_lvalue_reference_v<_G>); - using _UnCV = remove_cvref_t<_G>; - - if constexpr (_Has_id_ADL<_G, _UnCV>) { + if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(incidence(declval<_G>(), declval>())))}; // intentional ADL - } else if constexpr (_Can_id_eval<_G, _UnCV>) { + } else if constexpr (_Can_id_eval<_G>) { return {_St_id::_Auto_eval, noexcept(_Fake_copy_init(incidence_view<_G, false, void>( incidence_iterator<_G, false, void>(declval<_G>(), declval>()), @@ -296,12 +294,10 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id_evf() noexcept { static_assert(is_lvalue_reference_v<_G>); - using _UnCV = remove_cvref_t<_G>; - - if constexpr (_Has_id_evf_ADL<_G, _UnCV, EVF>) { + if constexpr (_Has_id_evf_ADL<_G, EVF>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(incidence(declval<_G>(), declval>(), declval())))}; // intentional ADL - } else if constexpr (_Can_id_evf_eval<_G, _UnCV, EVF>) { + } else if constexpr (_Can_id_evf_eval<_G, EVF>) { return {_St_id::_Auto_eval, noexcept(_Fake_copy_init(incidence_view<_G, false, EVF>( incidence_iterator<_G, false, EVF>(declval<_G>(), declval>(), declval()), diff --git a/include/graph/views/neighbors.hpp b/include/graph/views/neighbors.hpp index 08f561b..e6b1fb7 100644 --- a/include/graph/views/neighbors.hpp +++ b/include/graph/views/neighbors.hpp @@ -273,21 +273,21 @@ namespace views { void neighbors(); #endif // ^^^ workaround ^^^ - template + template concept _Has_id_ADL = adjacency_list<_G> && requires(_G&& __g, const vertex_id_t<_G>& uid) { { _Fake_copy_init(neighbors(__g, uid)) }; // intentional ADL }; - template + template concept _Can_id_eval = adjacency_list<_G> && requires(_G&& __g, vertex_id_t<_G>& uid) { { _Fake_copy_init(edges(__g, uid)) }; }; - template + template concept _Has_id_vvf_ADL = adjacency_list<_G> && invocable> && requires(_G&& __g, const vertex_id_t<_G>& uid, const VVF& vvf) { { _Fake_copy_init(neighbors(__g, uid, vvf)) }; // intentional ADL }; - template + template concept _Can_id_vvf_eval = adjacency_list<_G> && invocable>; class _Cpo { @@ -298,12 +298,10 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id() noexcept { static_assert(is_lvalue_reference_v<_G>); - using _UnCV = remove_cvref_t<_G>; - - if constexpr (_Has_id_ADL<_G, _UnCV>) { + if constexpr (_Has_id_ADL<_G>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(neighbors(declval<_G>(), declval>())))}; // intentional ADL - } else if constexpr (_Can_id_eval<_G, _UnCV>) { + } else if constexpr (_Can_id_eval<_G>) { return {_St_id::_Auto_eval, noexcept(_Fake_copy_init(neighbors_view<_G, false, void>( neighbor_iterator<_G, false, void>(declval<_G>(), declval>()), @@ -319,12 +317,10 @@ namespace views { template [[nodiscard]] static consteval _Choice_t<_St_id> _Choose_id_vvf() noexcept { static_assert(is_lvalue_reference_v<_G>); - using _UnCV = remove_cvref_t<_G>; - - if constexpr (_Has_id_vvf_ADL<_G, _UnCV, VVF>) { + if constexpr (_Has_id_vvf_ADL<_G, VVF>) { return {_St_id::_Non_member, noexcept(_Fake_copy_init(neighbors(declval<_G>(), declval>(), declval())))}; // intentional ADL - } else if constexpr (_Can_id_vvf_eval<_G, _UnCV, VVF>) { + } else if constexpr (_Can_id_vvf_eval<_G, VVF>) { return {_St_id::_Auto_eval, noexcept(_Fake_copy_init(neighbors_view<_G, false, VVF>( neighbor_iterator<_G, false, VVF>(declval<_G>(), declval>(), declval()),