bitset

any · at · bitset · bitset_size · count · element_type · flip · none · operator!= · operator&= · operator<< · operator<<= · operator== · operator>> · operator>>= · operator[] · operator^= · operator|= · operator~ · reference · reset · set · size · test · to_string · to_ulong

template<size_t N>
    class bitset {
public:
    typedef bool element_type;
    class reference;
    bitset();
    bitset(unsigned long val);
    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);
    bitset<N>& operator&=(const bitset<N>& rhs);
    bitset<N>& operator|=(const bitset<N>& rhs);
    bitset<N>& operator^=(const bitset<N>& rhs);
    bitset<N>& operator<<=(const bitset<N>& pos);
    bitset<N>& operator>>=(const bitset<N>& pos);
    bitset<N>& set();
    bitset<N>& set(size_t pos, bool val = true);
    bitset<N>& reset();
    bitset<N>& reset(size_t pos);
    bitset<N>& flip();
    bitset<N>& flip(size_t pos);
    reference operator[](size_t pos);
    bool operator[](size_t pos) const;
    reference at(size_t pos);
    bool at(size_t pos) const;
    unsigned long to_ulong() const;
    template<class E, class T, class A>
        string to_string() const;
    size_t count() const;
    size_t size() const;
    bool operator==(const bitset<N>& rhs) const;
    bool operator!=(const bitset<N>& rhs) const;
    bool test(size_t pos) const;
    bool any() const;
    bool none() const;
    bitset<N> operator<<(size_t pos) const;
    bitset<N> operator>>(size_t pos) const;
    bitset<N> operator~();
    static const size_t bitset_size = N;
    };

The template class describes an object that stores a sequence of N bits. A bit is set if its value is 1, reset if its value is 0. To flip a bit is to change its value from 1 to 0 or from 0 to 1. When converting between an object of class bitset<N> and an object of some integral type, bit position j corresponds to the bit value 1 << j. The integral value corresponding to two or more bits is the sum of their bit values.