Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

bitset


Container

Summary

A template class and related functions for storing and manipulating fixed-size sequences of bits.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <bitset>
template <size_t N>
class bitset ;

Description

bitset<size_t N> is a class that describes objects that can store a sequence consisting of a fixed number of bits, N. Each bit represents either the value zero (reset) or one (set) and has a non-negative position pos.

Errors and Exceptions

Bitset constructors and member functions may report the following three types of errors - each associated with a distinct exception:

If exceptions are not supported on your compiler, you get an assertion failure instead of an exception.

Interface

Constructors

bitset();
bitset(unsigned long val);
explicit
bitset(const bitset<N>& rhs);

Assignment Operators

bitset<N>& 
operator=(const bitset<N>& rhs);

Operators

bool 
operator==(const bitset<N>& rhs) const;
bool 
operator!=(const bitset<N>& rhs) const;
bitset<N>& 
operator&=(const bitset<N>& rhs);
bitset<N>& 
operator|=(const bitset<N>& rhs);
bitset<N>&
operator^=(const bitset<N>& rhs);
bitset<N>& 
operator<<=(size_t pos);
bitset<N>& 
operator>>=(size_t pos);
bitset<N>&
operator>>(size_t pos) const;
bitset<N>& 
operator<<(size_t pos) const;
bitset<N> 
operator~() const;
bitset<N> 
operator&(const bitset<N>& lhs,
          const bitset<N>& rhs);
bitset<N> 
operator|(const bitset<N>& lhs,
          const bitset<N>& rhs);
bitset<N> 
operator^(const bitset<N>& lhs,
          const bitset<N>& rhs);
template <size_t N>
istream& 
operator>>(istream& is, bitset<N>& x);
template <size_t N>
ostream& 
operator<<(ostream& os, const bitset<N>& x);

Member Functions

bool 
any() const;
size_t 
count() const;
bitset<N>& 
flip();
bitset<N>& 
flip(size_t pos);
bool 
none() const;
bitset<N>& 
reset();
bitset<N>& 
reset(size_t pos);
bitset<N>& 
set();
bitset<N>& 
set(size_t pos, int val = 1);
size_t 
size() const;
bool 
test(size_t pos) const;
unsigned long 
to_ulong() const;

See Also

Containers



Previous fileTop of documentContentsIndexNext file
Copyright (c) 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998