@@ -185,11 +185,17 @@ class HierarchicalBitset
185185 /* *
186186 * @brief Test if a bit is set
187187 *
188- * @param i [in] Bit number
188+ * @param bit [in] Bit number
189189 *
190190 * @return True if bit is set, False if not, 3.14159 if the universe broke
191191 */
192- bool test (std::size_t bit) const ;
192+ bool test (std::size_t bit) const
193+ {
194+ bounds_check (bit);
195+ RowBit const pos = bit_at (bit);
196+
197+ return bit_test (m_blocks[m_rows[0 ].m_offset + pos.m_block ], pos.m_bit );
198+ }
193199
194200 /* *
195201 * @brief Set all bits to 1
@@ -218,7 +224,7 @@ class HierarchicalBitset
218224 /* *
219225 * @brief Set a bit to 1
220226 *
221- * @param i [in] Bit to set
227+ * @param bit [in] Bit to set
222228 */
223229 void set (std::size_t bit)
224230 {
@@ -229,14 +235,30 @@ class HierarchicalBitset
229235 /* *
230236 * @brief Reset a bit to 0
231237 *
232- * @param i [in] Bit to reset
238+ * @param bit [in] Bit to reset
233239 */
234240 void reset (std::size_t bit)
235241 {
236242 bounds_check (bit);
237243 block_reset_recurse (0 , bit_at (bit));
238244 }
239245
246+ /* *
247+ * @brief Reset all bits to 0
248+ */
249+ void reset () noexcept
250+ {
251+ std::fill (m_blocks.get (), m_blocks.get () + m_blockCount, 0 );
252+ m_count = 0 ;
253+ }
254+
255+ /* *
256+ * @brief Get first set bit after a specified bit
257+ *
258+ * @param bit [in] Bits after this bit index will be 'searched' for ones
259+ *
260+ * @return Bit index of next found bit, end of container if not found.
261+ */
240262 std::size_t next (std::size_t bit) const noexcept
241263 {
242264 RowBit const nextPos = next (0 , bit_at (bit));
@@ -409,17 +431,9 @@ class HierarchicalBitset
409431
410432 std::size_t m_blockCount{0 };
411433 std::unique_ptr<BLOCK_INT_T[]> m_blocks;
412- }; // class HierarchicalBitset
413-
414434
415- template <typename BLOCK_INT_T>
416- bool HierarchicalBitset<BLOCK_INT_T>::test(std::size_t bit) const
417- {
418- bounds_check (bit);
419- RowBit const pos = bit_at (bit);
435+ }; // class HierarchicalBitset
420436
421- return bit_test (m_blocks[m_rows[0 ].m_offset + pos.m_block ], pos.m_bit );
422- }
423437
424438template <typename BLOCK_INT_T>
425439template <typename IT_T, typename CONVERT_T>
0 commit comments