boost::dynamic_bitset::extract

Returns the bitset made of the bits of *this in a given range.

Synopsis

Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>

dynamic_bitset
extract(
    size_type pos = 0,
    size_type len = npos) const;

Description

Like std::basic_string::substr(), extracts the bits in the range [pos, pos + rlen)], where rlen is the smaller of len and size() ‐ pos. The allocator of the result is obtained from that of *this as by the copy constructor.

Throws

An allocation error if memory is exhausted (std::bad_alloc if allocator_type is a std::allocator).

Return Value

A bitset r of size rlen such that, for all i in the range [0, rlen)], r[ i ]== ( *this )[ pos + i ].

Parameters

Name

Description

pos

The position of the first bit to extract.

len

The number of bits to extract, if *this has that many from pos on.

Preconditions

  • pos <= this‐>size().

Created with MrDocs