bm::bvector< Alloc >::counted_enumerator Class Reference
BitMagic Library » bvector<> container » bvector<> iterators

Constant iterator designed to enumerate "ON" bits counted_enumerator keeps bitcount, ie number of ON bits starting from the position 0 in the bit string up to the currently enumerated bit. More...

`#include <bm.h>`

Inheritance diagram for bm::bvector< Alloc >::counted_enumerator:
[legend]
Collaboration diagram for bm::bvector< Alloc >::counted_enumerator:
[legend]

## Public Types

typedef std::input_iterator_tag | iterator_category
Public Types inherited from bm::bvector< Alloc >::enumerator
typedef std::input_iterator_tag | iterator_category
typedef size_type | value_type
typedef unsigned | difference_type
typedef unsigned * | pointer
typedef unsigned & | reference

## Public Member Functions

| counted_enumerator () BMNOEXCEPT
| counted_enumerator (const enumerator &en) BMNOEXCEPT
counted_enumerator & | operator= (const enumerator &en) BMNOEXCEPT
counted_enumerator & | operator++ () BMNOEXCEPT
counted_enumerator | operator++ (int)
size_type | count () const BMNOEXCEPT
| Number of bits ON starting from the .
Public Member Functions inherited from bm::bvector< Alloc >::enumerator
| enumerator () BMNOEXCEPT
| enumerator (const bvector< Alloc > *bv) BMNOEXCEPT
| Construct enumerator associated with a vector. Important: This construction creates unpositioned iterator with status valid() == false. It can be re-positioned using go_first() or go_to().
| enumerator (const bvector< Alloc > &bv, size_type pos=0) BMNOEXCEPT
| Construct enumerator for bit vector.
| enumerator (const bvector< Alloc > *bv, size_type pos) BMNOEXCEPT
| Construct enumerator for bit vector.
size_type | operator* () const BMNOEXCEPT
| Get current position (value).
size_type | value () const BMNOEXCEPT
| Get current position (value).
enumerator & | operator++ () BMNOEXCEPT
| Advance enumerator forward to the next available bit.
enumerator | operator++ (int) BMNOEXCEPT
| Advance enumerator forward to the next available bit. Possibly do NOT use this operator it is slower than the pre-fix increment.
void | go_first () BMNOEXCEPT
| Position enumerator to the first available bit.
bool | advance () BMNOEXCEPT
bool | go_up () BMNOEXCEPT
| Advance enumerator to the next available bit.
bool | skip_to_rank (size_type rank) BMNOEXCEPT
| Skip to specified relative rank.
bool | skip (size_type rank) BMNOEXCEPT
| Skip specified number of bits from enumeration.
bool | go_to (size_type pos) BMNOEXCEPT
| go to a specific position in the bit-vector (or next)
Public Member Functions inherited from bm::bvector< Alloc >::iterator_base
| iterator_base () BMNOEXCEPT
bool | operator== (const iterator_base &it) const BMNOEXCEPT
bool | operator!= (const iterator_base &it) const BMNOEXCEPT
bool | operator< (const iterator_base &it) const BMNOEXCEPT
bool | operator<= (const iterator_base &it) const BMNOEXCEPT
bool | operator> (const iterator_base &it) const BMNOEXCEPT
bool | operator>= (const iterator_base &it) const BMNOEXCEPT
bool | valid () const BMNOEXCEPT
| Checks if iterator is still valid.
void | invalidate () BMNOEXCEPT
| Turns iterator into an invalid state.
bool | compare_state (const iterator_base &ib) const BMNOEXCEPT
| Compare FSMs for testing purposes.

## Additional Inherited Members

Protected Attributes inherited from bm::bvector< Alloc >::iterator_base
bm::bvector< Alloc > * | bv_
| Pointer on parent bitvector.
size_type | position_
| Bit position (bit idx).
const bm::word_t * | block_
| Block pointer.(NULL-invalid).
unsigned | block_type_
| Type of block. 0-Bit, 1-GAP.
block_idx_type | block_idx_
| Block index.
union bm::bvector::iterator_base::block_descr | bdescr_

## Detailed Description

template<class Alloc>
class bm::bvector< Alloc >::counted_enumerator

Constant iterator designed to enumerate "ON" bits counted_enumerator keeps bitcount, ie number of ON bits starting from the position 0 in the bit string up to the currently enumerated bit.

When increment operator called current position is increased by 1.

Examples
  sample11.cpp.

Definition at line 733 of file bm.h.

## Member Typedef Documentation

## iterator_category

template<class Alloc>

typedef std::input_iterator_tag bm::bvector< Alloc >::counted_enumerator::iterator_category

Definition at line 737 of file bm.h.

## Constructor & Destructor Documentation

## counted_enumerator() [1/2]

template<class Alloc>

bm::bvector< Alloc >::counted_enumerator::counted_enumerator | ( |  | ) |

inline

Definition at line 739 of file bm.h.

References BMNOEXCEPT.

Referenced by operator++(), operator++(), and operator=().

## counted_enumerator() [2/2]

template<class Alloc>

bm::bvector< Alloc >::counted_enumerator::counted_enumerator | ( | const enumerator & | en | ) |

inline

Definition at line 741 of file bm.h.

References BMNOEXCEPT, bm::bvector< Alloc >::enumerator::enumerator(), and bm::bvector< Alloc >::iterator_base::valid().

## Member Function Documentation

## count()

template<class Alloc>

size_type bm::bvector< Alloc >::counted_enumerator::count | ( |  | ) | const

inline

Number of bits ON starting from the .

Method returns number of ON bits fromn the bit 0 to the current bit For the first bit in bitvector it is 1, for the second 2

Examples
  sample11.cpp.

Definition at line 775 of file bm.h.

References BMNOEXCEPT.

Referenced by bv_counted_enumerator().

## operator++() [1/2]

template<class Alloc>

counted_enumerator & bm::bvector< Alloc >::counted_enumerator::operator++ | ( |  | ) |

inline

Definition at line 755 of file bm.h.

References BMNOEXCEPT, counted_enumerator(), bm::bvector< Alloc >::enumerator::go_up(), and bm::bvector< Alloc >::iterator_base::valid().

## operator++() [2/2]

template<class Alloc>

counted_enumerator bm::bvector< Alloc >::counted_enumerator::operator++ | ( | int |  | ) |

inline

Definition at line 762 of file bm.h.

References counted_enumerator(), bm::bvector< Alloc >::enumerator::go_up(), and bm::bvector< Alloc >::iterator_base::valid().

## operator=()

template<class Alloc>

counted_enumerator & bm::bvector< Alloc >::counted_enumerator::operator= | ( | const enumerator & | en | ) |

inline

Definition at line 746 of file bm.h.

References BMNOEXCEPT, counted_enumerator(), bm::bvector< Alloc >::enumerator::enumerator(), and bm::bvector< Alloc >::iterator_base::valid().

The documentation for this class was generated from the following file:

- bm.h