Skip to content

Commit

Permalink
update bitmatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
i80287 committed Jul 20, 2024
1 parent 5890203 commit cf8ea89
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions number_theory/bitmatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,19 @@ struct alignas(std::uint64_t) alignas(word_type) square_bitmatrix {
static constexpr std::size_t kBits = (N + kAlignmentBits - 1) & ~(kAlignmentBits - 1);
static_assert(sizeof(std::bitset<N>) == sizeof(std::bitset<kBits>));

template <class TFunction>
static constexpr bool is_noexcept_index_fn() noexcept {
return noexcept(std::declval<TFunction>()(size_type{}));
}
template <class TFunction>
static constexpr bool is_noexcept_coords_fn() noexcept {
return noexcept(std::declval<TFunction>()(size_type{}, size_type{}));
}
template <class TFunction>
static constexpr bool is_noexcept_bit_reference_fn() noexcept {
return noexcept(std::declval<TFunction>()(std::declval<bit_reference>()));
}

public:
using matrix_type = typename std::array<std::bitset<N>, kBits>;
using value_type = typename matrix_type::value_type;
Expand Down Expand Up @@ -627,18 +640,6 @@ struct alignas(std::uint64_t) alignas(word_type) square_bitmatrix {
#else
false;
#endif
template <class TFunction>
static constexpr bool is_noexcept_index_fn() noexcept {
return noexcept(std::declval<TFunction>()(size_type{}));
}
template <class TFunction>
static constexpr bool is_noexcept_coords_fn() noexcept {
return noexcept(std::declval<TFunction>()(size_type{}, size_type{}));
}
template <class TFunction>
static constexpr bool is_noexcept_bit_reference_fn() noexcept {
return noexcept(std::declval<TFunction>()(std::declval<bit_reference>()));
}
template <class TFunction>
ATTRIBUTE_ALWAYS_INLINE static constexpr void for_each_row_set_bit(
const row_type& row, TFunction fn) noexcept(is_noexcept_index_fn<TFunction>()) {
Expand Down

0 comments on commit cf8ea89

Please sign in to comment.