---
name: "__gnu_debug::def_bitset"
section: "3"
platform: "linux"
package: "libstdc++6-doc"
version: "3.4.6-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_debug::def_bitset"
---

# \_\_gnu\_debug::def\_bitset(3)

## NAME

\_\_gnu\_debug\_def::bitset -

## SYNOPSIS

Inherits **std::bitset\< Nb \>\< Nb \>**, and **\_\_gnu\_debug::Safe\_sequence\_base**.

### Public Member Functions

**bitset** ()\
 *All bits set to zero.*  **bitset** (unsigned long \_\_val)\
 *Initial bits bitwise-copied from a single word (others set to zero).*  template\<typename CharT, typename Traits, typename Allocator\> **bitset** (const **std::basic\_string**\< CharT, Traits, Allocator \> &str, typename **std::basic\_string**\< CharT, Traits, Allocator \>::size\_type position=0, typename **std::basic\_string**\< CharT, Traits, Allocator \>::size\_type n=(**std::basic\_string**\< CharT, Traits, Allocator \>::npos))\
 **bitset** (const **Base** &x)\
 **bitset**\< Nb \> & **operator &=** (const **bitset**\< Nb \> &\_\_rhs)\
 **bitset**\< Nb \> & **operator\|=** (const **bitset**\< Nb \> &\_\_rhs)\
 **bitset**\< Nb \> & **operator^=** (const **bitset**\< Nb \> &\_\_rhs)\
 **bitset**\< Nb \> & **operator\<\<=** (size\_t position)\
 *Operations on bitsets.*  **bitset**\< Nb \> & **operator\>\>=** (size\_t position)\
 *Operations on bitsets.*  **bitset**\< Nb \> & **set** ()\
 *Sets every bit to true.*  **bitset**\< Nb \> & **set** (size\_t position, bool \_\_val=true)\
 *Sets a given bit to a particular value.*  **bitset**\< Nb \> & **reset** ()\
 *Sets every bit to false.*  **bitset**\< Nb \> & **reset** (size\_t position)\
 *Sets a given bit to false.*  **bitset**\< Nb \> **operator~** () const\
 *See the no-argument* **flip()***.*  **bitset**\< Nb \> & **flip** ()\
 *Toggles every bit to its opposite value.*  **bitset**\< Nb \> & **flip** (size\_t position)\
 *Toggles a given bit to its opposite value.*  **reference** **operator\[\]** (size\_t position)\
 *Array-indexing support.*  bool **operator\[\]** (size\_t position) const\
 *Array-indexing support.*  template\<typename CharT, typename Traits, typename Allocator\> **std::basic\_string**\< CharT, Traits, Allocator \> **to\_string** () const\
 *Retuns a character interpretation of the bitset.*  bool **operator==** (const **bitset**\< Nb \> &\_\_rhs) const\
 bool **operator!=** (const **bitset**\< Nb \> &\_\_rhs) const\
 **bitset**\< Nb \> **operator\<\<** (size\_t position) const\
 *Self-explanatory.*  **bitset**\< Nb \> **operator\>\>** (size\_t position) const\
 *Self-explanatory.*  **Base** & **M\_base** ()\
 const **Base** & **M\_base** () const\
 unsigned long **to\_ulong** () const\
 *Retuns a numerical interpretation of the bitset.*  template\<class CharT, class Traits, class Alloc\> void **M\_copy\_from\_string** (const basic\_string\< CharT, Traits, Alloc \> &s, size\_t, size\_t)\
 template\<class CharT, class Traits, class Alloc\> void **M\_copy\_to\_string** (basic\_string\< CharT, Traits, Alloc \> &) const\
 size\_t **count** () const\
 *Returns the number of bits which are set.*  size\_t **size** () const\
 *Returns the total number of bits.*  bool **test** (size\_t position) const\
 *Tests the value of a bit.*  bool **any** () const\
 *Tests whether any of the bits are on.*  bool **none** () const\
 *Tests whether any of the bits are on.*  size\_t **Find\_first** () const\
 *Finds the index of the first 'on' bit.*  size\_t **Find\_next** (size\_t \_\_prev) const\
 *Finds the index of the next 'on' bit after prev.*  void **M\_invalidate\_all** () const\

**bitset**\< Nb \> & **operator &=** (const **bitset**\< Nb \> &\_\_rhs)\
 *Operations on bitsets.*  **bitset**\< Nb \> & **operator\|=** (const **bitset**\< Nb \> &\_\_rhs)\
 *Operations on bitsets.*  **bitset**\< Nb \> & **operator^=** (const **bitset**\< Nb \> &\_\_rhs)\
 *Operations on bitsets.*

**bitset**\< Nb \> & **Unchecked\_set** (size\_t position)\
 **bitset**\< Nb \> & **Unchecked\_set** (size\_t position, int \_\_val)\
 **bitset**\< Nb \> & **Unchecked\_reset** (size\_t position)\
 **bitset**\< Nb \> & **Unchecked\_flip** (size\_t position)\
 bool **Unchecked\_test** (size\_t position) const\

bool **operator==** (const **bitset**\< Nb \> &\_\_rhs) const\
 *These comparisons for equality/inequality are, well, bitwise.*  bool **operator!=** (const **bitset**\< Nb \> &\_\_rhs) const\
 *These comparisons for equality/inequality are, well, bitwise.*

### Public Attributes

Safe\_iterator\_base \* **M\_iterators**\
 *The list of mutable iterators that reference this container.*  Safe\_iterator\_base \* **M\_const\_iterators**\
 *The list of constant iterators that reference this container.*  unsigned int **M\_version**\
 *The container version number. This number may never be 0.*

### Protected Member Functions

void **M\_detach\_all** ()\
 void **M\_detach\_singular** ()\
 void **M\_revalidate\_singular** ()\
 void **M\_swap** (Safe\_sequence\_base &x)\

### Private Types

typedef **std::bitset**\< Nb \> **Base**\
 typedef **\_\_gnu\_debug::Safe\_sequence\_base** **Safe\_base**\

### Friends

class **reference**\

### Classes

class **reference**\

## Detailed Description

### template\<size\_t Nb\> class \_\_gnu\_debug\_def::bitset\< Nb \>

Definition at line 41 of file debug/bitset.

## Constructor & Destructor Documentation

### template\<size\_t Nb\> \_\_gnu\_debug\_def::bitset\< Nb \>::bitset ()` [inline]`

All bits set to zero.

Reimplemented from **std::bitset\< Nb \>**.

Definition at line 119 of file debug/bitset.

Referenced by \_\_gnu\_debug\_def::bitset\< Nb \>::operator~().

### template\<size\_t Nb\> \_\_gnu\_debug\_def::bitset\< Nb \>::bitset (unsigned long \_\_val)` [inline]`

Initial bits bitwise-copied from a single word (others set to zero).

Reimplemented from **std::bitset\< Nb \>**.

Definition at line 121 of file debug/bitset.

## Member Function Documentation

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::operator\<\<= (size\_t position)` [inline]`

Operations on bitsets.

**Parameters:**

*position* The number of places to shift.

These should be self-explanatory.

Reimplemented from **std::bitset\< Nb \>**.

Definition at line 157 of file debug/bitset.

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::operator\>\>= (size\_t position)` [inline]`

Operations on bitsets.

**Parameters:**

*position* The number of places to shift.

These should be self-explanatory.

Reimplemented from **std::bitset\< Nb \>**.

Definition at line 164 of file debug/bitset.

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::set ()` [inline]`

Sets every bit to true.

Reimplemented from **std::bitset\< Nb \>**.

Definition at line 171 of file debug/bitset.

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::set (size\_t position, bool \_\_val = `true`)` [inline]`

Sets a given bit to a particular value.

**Parameters:**

*position* The index of the bit. \
 *val* Either true or false, defaults to true.

**Exceptions:**

**std::out\_of\_range If** *pos* **is bigger the size of the set.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 180 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::reset ()` [inline]`

**Sets every bit to false.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 187 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::reset (size\_t position)` [inline]`

**Sets a given bit to false.**

**Parameters:**

*position* **The index of the bit.**

**Exceptions:**

**std::out\_of\_range If** *pos* **is bigger the size of the set.**

**Same as writing** `set(pos,false)`**.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 194 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\> \_\_gnu\_debug\_def::bitset\< Nb \>::operator~ () const` [inline]`

**See the no-argument flip().**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 200 of file debug/bitset.**

**References \_\_gnu\_debug\_def::bitset\< Nb \>::bitset().**

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::flip ()` [inline]`

**Toggles every bit to its opposite value.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 203 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\>& \_\_gnu\_debug\_def::bitset\< Nb \>::flip (size\_t position)` [inline]`

**Toggles a given bit to its opposite value.**

**Parameters:**

*position* **The index of the bit.**

**Exceptions:**

**std::out\_of\_range If** *pos* **is bigger the size of the set.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 210 of file debug/bitset.**

### template\<size\_t Nb\> reference \_\_gnu\_debug\_def::bitset\< Nb \>::operator\[\] (size\_t position)` [inline]`

**Array-indexing support.**

**Parameters:**

*position* **Index into the bitset.**

**Returns:**

**A bool for a 'const bitset'. For non-const bitsets, an instance of the reference proxy class.**

**Note:**

**These operators do no range checking and throw no exceptions, as required by DR 11 to the standard.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 220 of file debug/bitset.**

**References std::bitset\< Nb \>::reference.**

### template\<size\_t Nb\> bool \_\_gnu\_debug\_def::bitset\< Nb \>::operator\[\] (size\_t position) const` [inline]`

**Array-indexing support.**

**Parameters:**

*position* **Index into the bitset.**

**Returns:**

**A bool for a 'const bitset'. For non-const bitsets, an instance of the reference proxy class.**

**Note:**

**These operators do no range checking and throw no exceptions, as required by DR 11 to the standard.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 229 of file debug/bitset.**

### template\<size\_t Nb\> template\<typename CharT, typename Traits, typename Allocator\> std::basic\_string\<CharT, Traits, Allocator\> \_\_gnu\_debug\_def::bitset\< Nb \>::to\_string () const` [inline]`

**Retuns a character interpretation of the bitset.**

**Returns:**

**The string equivalent of the bits.**

**Note the ordering of the bits: decreasing character positions correspond to increasing bit positions (see the main class notes for an example).**

**Also note that you must specify the string's template parameters explicitly. Given a bitset** `bs` **and a string :**

```
     s = bs.to_string<char,char_traits<char>,allocator<char> >();
```

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 239 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\> \_\_gnu\_debug\_def::bitset\< Nb \>::operator\<\< (size\_t position) const` [inline]`

**Self-explanatory.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 258 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\> \_\_gnu\_debug\_def::bitset\< Nb \>::operator\>\> (size\_t position) const` [inline]`

**Self-explanatory.**

**Reimplemented from std::bitset\< Nb \>.**

**Definition at line 262 of file debug/bitset.**

### template\<size\_t Nb\> bitset\<Nb\>& std::bitset\< Nb \>::operator &= (const bitset\< Nb \> & \_\_rhs)` [inline, inherited]`

**Operations on bitsets.**

**Parameters:**

*rhs* **A same-sized bitset.**

**These should be self-explanatory.**

**Definition at line 745 of file bitset.**

### template\<size\_t Nb\> bitset\<Nb\>& std::bitset\< Nb \>::operator\|= (const bitset\< Nb \> & \_\_rhs)` [inline, inherited]`

**Operations on bitsets.**

**Parameters:**

*rhs* **A same-sized bitset.**

**These should be self-explanatory.**

**Definition at line 752 of file bitset.**

### template\<size\_t Nb\> bitset\<Nb\>& std::bitset\< Nb \>::operator^= (const bitset\< Nb \> & \_\_rhs)` [inline, inherited]`

**Operations on bitsets.**

**Parameters:**

*rhs* **A same-sized bitset.**

**These should be self-explanatory.**

**Definition at line 759 of file bitset.**

### template\<size\_t Nb\> unsigned long std::bitset\< Nb \>::to\_ulong () const` [inline, inherited]`

**Retuns a numerical interpretation of the bitset.**

**Returns:**

**The integral equivalent of the bits.**

**Exceptions:**

**std::overflow\_error If there are too many bits to be represented in an** `unsigned` `long`**.**

**Definition at line 955 of file bitset.**

### template\<size\_t Nb\> size\_t std::bitset\< Nb \>::count () const` [inline, inherited]`

**Returns the number of bits which are set.**

**Definition at line 992 of file bitset.**

### template\<size\_t Nb\> size\_t std::bitset\< Nb \>::size () const` [inline, inherited]`

**Returns the total number of bits.**

**Definition at line 996 of file bitset.**

### template\<size\_t Nb\> bool std::bitset\< Nb \>::operator== (const bitset\< Nb \> & \_\_rhs) const` [inline, inherited]`

**These comparisons for equality/inequality are, well,** *bitwise***.**

**Definition at line 1001 of file bitset.**

### template\<size\_t Nb\> bool std::bitset\< Nb \>::operator!= (const bitset\< Nb \> & \_\_rhs) const` [inline, inherited]`

**These comparisons for equality/inequality are, well,** *bitwise***.**

**Definition at line 1005 of file bitset.**

### template\<size\_t Nb\> bool std::bitset\< Nb \>::test (size\_t position) const` [inline, inherited]`

**Tests the value of a bit.**

**Parameters:**

*position* **The index of a bit.**

**Returns:**

**The value at** *pos***.**

**Exceptions:**

**std::out\_of\_range If** *pos* **is bigger the size of the set.**

**Definition at line 1016 of file bitset.**

**References std::\_\_throw\_out\_of\_range().**

### template\<size\_t Nb\> bool std::bitset\< Nb \>::any () const` [inline, inherited]`

**Tests whether any of the bits are on.**

**Returns:**

**True if at least one bit is set.**

**Definition at line 1028 of file bitset.**

### template\<size\_t Nb\> bool std::bitset\< Nb \>::none () const` [inline, inherited]`

**Tests whether any of the bits are on.**

**Returns:**

**True if none of the bits are set.**

**Definition at line 1035 of file bitset.**

### void \_\_gnu\_debug::Safe\_sequence\_base::M\_detach\_all ()` [protected, inherited]`

**Detach all iterators, leaving them singular.**

**Definition at line 114 of file debug.cc.**

### void \_\_gnu\_debug::Safe\_sequence\_base::M\_detach\_singular ()` [protected, inherited]`

**Detach all singular iterators.**

**Postcondition:**

**for all iterators i attached to this sequence, i-\>M\_version == M\_version.**

**Definition at line 133 of file debug.cc.**

### void \_\_gnu\_debug::Safe\_sequence\_base::M\_revalidate\_singular ()` [protected, inherited]`

**Revalidates all attached singular iterators. This method may be used to validate iterators that were invalidated before (but for some reasion, such as an exception, need to become valid again).**

**Definition at line 154 of file debug.cc.**

### void \_\_gnu\_debug::Safe\_sequence\_base::M\_swap (Safe\_sequence\_base & x)` [protected, inherited]`

**Swap this sequence with the given sequence. This operation also swaps ownership of the iterators, so that when the operation is complete all iterators that originally referenced one container now reference the other container.**

**Definition at line 172 of file debug.cc.**

**References \_\_gnu\_debug::swap().**

### void \_\_gnu\_debug::Safe\_sequence\_base::M\_invalidate\_all () const` [inline, inherited]`

**Invalidates all iterators.**

**Definition at line 202 of file safe\_base.h.**

## Member Data Documentation

### Safe\_iterator\_base\* \_\_gnu\_debug::Safe\_sequence\_base::M\_iterators` [inherited]`

**The list of mutable iterators that reference this container.**

**Definition at line 153 of file safe\_base.h.**

### Safe\_iterator\_base\* \_\_gnu\_debug::Safe\_sequence\_base::M\_const\_iterators` [inherited]`

**The list of constant iterators that reference this container.**

**Definition at line 156 of file safe\_base.h.**

### unsigned int \_\_gnu\_debug::Safe\_sequence\_base::M\_version` [mutable, inherited]`

**The container version number. This number may never be 0.**

**Definition at line 159 of file safe\_base.h.**

## Author

**Generated automatically by Doxygen for libstdc++-v3 Source from the source code.**
