bitset::bitset

bitset();
bitset(unsigned long val);
explicit bitset(const string& str,
    size_t pos = 0, size_t n = -1);

The first constructor resets all bits in the bit sequence. The second constructor sets only those bits at position j for which val & 1 << j is nonzero.

The third constructor determines the initial bit values from elements of a string determined from str. If str.size() < pos, the constructor throws out_of_range. Otherwise, the effective length of the string rlen is the smaller of n and str.size() - pos. If any of the rlen elements beginning at position pos is other than 0 or 1, the constructor throws invalid_argument. Otherwise, the constructor sets only those bits at position j for which the element at position pos + j is 1.

In this implementation, if a translator does not support member template functions, the template:

template<class E, class T, class A>
    explicit bitset(const string<E, T, A>& str,
        string<E, T, A>size_type pos = 0,
        string<E, T, A>size_type n = string<E, T, A>::npos);

is replaced by:

explicit bitset(const string& str,
    size_t pos = 0, size_t n = -1);