Commit 70e12fb9 by Phil Edwards

std_bitset.h: Better comments.

2002-12-29  Phil Edwards  <pme@gcc.gnu.org>

	* include/std/std_bitset.h:  Better comments.

From-SVN: r60614
parent c85263d2
2002-12-29 Phil Edwards <pme@gcc.gnu.org>
* include/std/std_bitset.h: Better comments.
2002-12-28 Joseph S. Myers <jsm@polyomino.org.uk> 2002-12-28 Joseph S. Myers <jsm@polyomino.org.uk>
* docs/html/17_intro/porting.texi: Use @copying. * docs/html/17_intro/porting.texi: Use @copying.
......
...@@ -570,6 +570,7 @@ namespace std ...@@ -570,6 +570,7 @@ namespace std
struct _Sanitize<0> struct _Sanitize<0>
{ static void _S_do_sanitize(unsigned long) { } }; { static void _S_do_sanitize(unsigned long) { } };
/** /**
* @brief The %bitset class represents a @e fixed-size sequence of bits. * @brief The %bitset class represents a @e fixed-size sequence of bits.
* *
...@@ -578,19 +579,19 @@ namespace std ...@@ -578,19 +579,19 @@ namespace std
* (Note that %bitset does @e not meet the formal requirements of a * (Note that %bitset does @e not meet the formal requirements of a
* <a href="tables.html#65">container</a>. Mainly, it lacks iterators.) * <a href="tables.html#65">container</a>. Mainly, it lacks iterators.)
* *
* The template argument, @a _Nb, may be any non-negative number of type * The template argument, @a Nb, may be any non-negative number,
* size_t. * specifying the number of bits (e.g., "0", "12", "1024*1024").
* *
* A %bitset of size N uses U bits, where * In the general unoptimized case, storage is allocated in word-sized
* U = (N % (sizeof(unsigned long) * CHAR_BIT)). * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B
* Thus, N - U bits are unused. (They are the high-order bits in the * words will be used for storage. B - Nb%B bits are unused. (They are
* highest word.) It is a class invariant that those unused bits are * the high-order bits in the highest word.) It is a class invariant
* always zero. * that those unused bits are always zero.
* *
* If you think of %bitset as "a simple array of bits," be aware that * If you think of %bitset as "a simple array of bits," be aware that
* your mental picture is reversed: a %bitset behaves the same way as * your mental picture is reversed: a %bitset behaves the same way as
* bits in integers do, with the bit at index 0 in the "least significant * bits in integers do, with the bit at index 0 in the "least significant
* / right-hand" position, and the bit at index N-1 in the "most * / right-hand" position, and the bit at index Nb-1 in the "most
* significant / left-hand" position. Thus, unlike other containers, a * significant / left-hand" position. Thus, unlike other containers, a
* %bitset's index "counts from right to left," to put it very loosely. * %bitset's index "counts from right to left," to put it very loosely.
* *
...@@ -621,6 +622,7 @@ namespace std ...@@ -621,6 +622,7 @@ namespace std
* @endcode * @endcode
* *
* Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23
* for a description of extensions.
* *
* @if maint * @if maint
* Most of the actual code isn't contained in %bitset<> itself, but in the * Most of the actual code isn't contained in %bitset<> itself, but in the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment