36 template <
class B,
bool is_const>
38 bitset_iterator<B, is_const>,
39 mpl::constify_t<typename B::value_type, is_const>,
40 std::random_access_iterator_tag,
41 std::conditional_t<is_const, bool, bitset_reference<B>>>
49 std::contiguous_iterator_tag,
50 std::conditional_t<is_const, bool, bitset_reference<B>>>;
63 constexpr
reference dereference() const noexcept;
64 constexpr
void increment();
65 constexpr
void decrement();
68 [[nodiscard]] constexpr
bool equal(const
self_type& rhs) const noexcept;
69 [[nodiscard]] constexpr
bool less_than(const
self_type& rhs) const noexcept;
71 [[nodiscard]] constexpr
bool is_first_bit_of_block(
size_type index) const noexcept;
83 template <class B,
bool is_const>
92 template <
class B,
bool is_const>
93 constexpr auto bitset_iterator<B, is_const>::dereference() const noexcept ->
reference
95 if constexpr (is_const)
97 if (p_bitset->data() ==
nullptr)
101 return (*p_block) & bitset_type::bit_mask(m_index);
105 return bitset_reference<B>(*p_bitset, *p_block, bitset_type::bit_mask(m_index));
109 template <
class B,
bool is_const>
114 if (is_first_bit_of_block(m_index))
122 template <
class B,
bool is_const>
126 if (is_first_bit_of_block(m_index))
129 m_index = bitset_type::s_bits_per_block - 1;
138 template <
class B,
bool is_const>
143 if (std::cmp_less(n, bitset_type::s_bits_per_block - m_index))
149 const size_type to_next_block = bitset_type::s_bits_per_block - m_index;
152 p_block += block_n + 1;
153 n -=
static_cast<difference_type>(block_n * bitset_type::s_bits_per_block);
166 const size_type block_n = mn / bitset_type::s_bits_per_block;
168 mn -= block_n * bitset_type::s_bits_per_block;
177 m_index = bitset_type::s_bits_per_block - mn;
184 template <
class B,
bool is_const>
188 if (p_block == rhs.p_block)
194 const auto dist1 = distance_to_begin();
195 const auto dist2 = rhs.distance_to_begin();
196 return dist2 - dist1;
200 template <
class B,
bool is_const>
203 return p_block == rhs.p_block && m_index == rhs.m_index;
206 template <
class B,
bool is_const>
209 return (p_block < rhs.p_block) || (p_block == rhs.p_block && m_index < rhs.m_index);
212 template <
class B,
bool is_const>
215 return index % bitset_type::s_bits_per_block == 0;
218 template <
class B,
bool is_const>
223 return static_cast<difference_type>(bitset_type::s_bits_per_block) * distance
typename base_type::reference reference
constexpr bitset_iterator() noexcept=default
mpl::constify_t< B, is_const > bitset_type
iterator_base< self_type, mpl::constify_t< typename B::value_type, is_const >, std::contiguous_iterator_tag, std::conditional_t< is_const, bool, bitset_reference< B > > > base_type
mpl::constify_t< typename B::block_type, is_const > block_type
typename B::size_type size_type
bitset_iterator< B, is_const > self_type
friend class iterator_access
typename base_type::difference_type difference_type
Reference proxy used by the bitset_iterator class to make it possible to assign a bit of a bitset as ...
#define SPARROW_ASSERT_TRUE(expr__)
typename constify< T, is_const >::type constify_t