99#include " hgl/types/types.hpp"
1010
1111#include < algorithm>
12+ #include < cstddef>
13+ #include < cstdint>
1214#include < ranges>
1315#include < vector>
14- #include < cstdint>
1516
1617#ifdef HGL_TESTING
1718namespace hgl_testing {
@@ -63,7 +64,8 @@ class incidence_matrix<hgl::undirected_t, LayoutTag> final {
6364 this ->_remove_minor (vertex_id);
6465 }
6566
66- [[nodiscard]] gl_attr_force_inline auto incident_hyperedges (const types::id_type vertex_id
67+ [[nodiscard]] gl_attr_force_inline auto incident_hyperedges (
68+ const types::id_type vertex_id
6769 ) const noexcept {
6870 if constexpr (std::same_as<layout_tag, impl::vertex_major_t >)
6971 return this ->_incident_with_major (vertex_id);
@@ -94,16 +96,16 @@ class incidence_matrix<hgl::undirected_t, LayoutTag> final {
9496 this ->_remove_minor (hyperedge_id);
9597 }
9698
97- [[nodiscard]] gl_attr_force_inline auto incident_vertices (const types::id_type hyperedge_id
99+ [[nodiscard]] gl_attr_force_inline auto incident_vertices (
100+ const types::id_type hyperedge_id
98101 ) const noexcept {
99102 if constexpr (std::same_as<layout_tag, impl::hyperedge_major_t >)
100103 return this ->_incident_with_major (hyperedge_id);
101104 else
102105 return this ->_incident_with_minor (hyperedge_id);
103106 }
104107
105- [[nodiscard]] types::size_type hyperedge_size (const types::id_type hyperedge_id
106- ) const noexcept {
108+ [[nodiscard]] types::size_type hyperedge_size (const types::id_type hyperedge_id) const noexcept {
107109 if constexpr (std::same_as<layout_tag, impl::hyperedge_major_t >)
108110 return this ->_count_major (hyperedge_id);
109111 else
@@ -154,15 +156,15 @@ class incidence_matrix<hgl::undirected_t, LayoutTag> final {
154156 }
155157
156158 gl_attr_force_inline void _remove_major (const types::id_type major_id) noexcept {
157- this ->_matrix .erase (this ->_matrix .begin () + major_id);
159+ this ->_matrix .erase (this ->_matrix .begin () + static_cast <std:: ptrdiff_t >( major_id) );
158160 }
159161
160162 gl_attr_force_inline void _remove_minor (const types::id_type minor_id) noexcept {
161163 if (this ->_matrix_row_size == 0 )
162164 return ;
163165 this ->_matrix_row_size --;
164166 for (auto & row : this ->_matrix ) {
165- row.erase (row.begin () + minor_id);
167+ row.erase (row.begin () + static_cast <std:: ptrdiff_t >( minor_id) );
166168 }
167169 }
168170
@@ -211,7 +213,8 @@ class incidence_matrix<hgl::bf_directed_t, LayoutTag> final {
211213 incidence_matrix (const types::size_type n_vertices, const types::size_type n_hyperedges)
212214 : _matrix_row_size{layout_tag::minor (n_vertices, n_hyperedges)},
213215 _matrix (
214- layout_tag::major (n_vertices, n_hyperedges), matrix_row_type(_matrix_row_size, incidence_type::none)
216+ layout_tag::major (n_vertices, n_hyperedges),
217+ matrix_row_type(_matrix_row_size, incidence_type::none)
215218 ) {}
216219
217220 incidence_matrix (incidence_matrix&&) = default;
@@ -235,7 +238,8 @@ class incidence_matrix<hgl::bf_directed_t, LayoutTag> final {
235238 this ->_remove_minor (vertex_id);
236239 }
237240
238- [[nodiscard]] gl_attr_force_inline auto incident_hyperedges (const types::id_type vertex_id
241+ [[nodiscard]] gl_attr_force_inline auto incident_hyperedges (
242+ const types::id_type vertex_id
239243 ) const noexcept {
240244 if constexpr (std::same_as<layout_tag, impl::vertex_major_t >)
241245 return this ->_incident_with_major (vertex_id);
@@ -268,16 +272,16 @@ class incidence_matrix<hgl::bf_directed_t, LayoutTag> final {
268272 this ->_remove_minor (hyperedge_id);
269273 }
270274
271- [[nodiscard]] gl_attr_force_inline auto incident_vertices (const types::id_type hyperedge_id
275+ [[nodiscard]] gl_attr_force_inline auto incident_vertices (
276+ const types::id_type hyperedge_id
272277 ) const noexcept {
273278 if constexpr (std::same_as<layout_tag, impl::hyperedge_major_t >)
274279 return this ->_incident_with_major (hyperedge_id);
275280 else
276281 return this ->_incident_with_minor (hyperedge_id);
277282 }
278283
279- [[nodiscard]] types::size_type hyperedge_size (const types::id_type hyperedge_id
280- ) const noexcept {
284+ [[nodiscard]] types::size_type hyperedge_size (const types::id_type hyperedge_id) const noexcept {
281285 if constexpr (std::same_as<layout_tag, impl::hyperedge_major_t >)
282286 return this ->_count_major (hyperedge_id);
283287 else
@@ -317,15 +321,14 @@ class incidence_matrix<hgl::bf_directed_t, LayoutTag> final {
317321
318322private:
319323 enum class incidence_type : std::int8_t {
320- none = 0 , // v not in E
324+ none = 0 , // v not in E
321325 backward = -1 , // v in T(E)
322- forward = 1 , // v in H(E)
326+ forward = 1 , // v in H(E)
323327 };
324328
325- template <typename P>
326- concept c_incidence_pred = std::predicate<P, incidence_type>;
327-
328- static constexpr auto _are_incident_pred = [](const incidence_type t) { return t != incidence_type::none; };
329+ static constexpr auto _are_incident_pred = [](const incidence_type t) {
330+ return t != incidence_type::none;
331+ };
329332
330333 using matrix_row_type = std::vector<incidence_type>;
331334 using hypergraph_storage_type = std::vector<matrix_row_type>;
@@ -370,7 +373,7 @@ class incidence_matrix<hgl::bf_directed_t, LayoutTag> final {
370373
371374 [[nodiscard]] types::size_type _count_major (
372375 const types::id_type major_id,
373- const c_incidence_pred auto pred = incidence_matrix::_are_incident_pred
376+ const std::predicate<incidence_type> auto pred = incidence_matrix::_are_incident_pred
374377 ) const noexcept {
375378 types::size_type count = 0 ;
376379 for (const incidence_type t : this ->_matrix [major_id])
@@ -380,7 +383,7 @@ class incidence_matrix<hgl::bf_directed_t, LayoutTag> final {
380383
381384 [[nodiscard]] types::size_type _count_minor (
382385 const types::id_type minor_id,
383- const c_incidence_pred auto pred = incidence_matrix::_are_incident_pred
386+ const std::predicate<incidence_type> auto pred = incidence_matrix::_are_incident_pred
384387 ) const noexcept {
385388 types::size_type count = 0 ;
386389 for (const auto & row : this ->_matrix )
0 commit comments