Boost logo

Boost-Commit :

From: gennaro.prota_at_[hidden]
Date: 2008-07-13 13:55:46


Author: gennaro_prota
Date: 2008-07-13 13:55:45 EDT (Sun, 13 Jul 2008)
New Revision: 47389
URL: http://svn.boost.org/trac/boost/changeset/47389

Log:
dynamic_bitset documentation and examples:

    Documentation:
    --------------

    * converted from HTML 4.01 Transitional to XHTML 1.1 (reason: the website
      uses already XHTML 1.0 Strict, and our page didn't validate as such, even
      though on the website a link to the W3C markup validation service is
      affixed)
    * removed some misleading sentences
    * referenced the source files of examples, so that they do not go out of
      sync again
    * clarified rationale section

    Example files:
    --------------

    * example 3 shows that stream extraction may expand the bitset
    * minor improvements to all examples

Text files modified:
   trunk/libs/dynamic_bitset/dynamic_bitset.html | 910 +++++++++++++++------------------------
   trunk/libs/dynamic_bitset/example/example1.cpp | 42 +
   trunk/libs/dynamic_bitset/example/example2.cpp | 7
   trunk/libs/dynamic_bitset/example/example3.cpp | 85 ++-
   4 files changed, 447 insertions(+), 597 deletions(-)

Modified: trunk/libs/dynamic_bitset/dynamic_bitset.html
==============================================================================
--- trunk/libs/dynamic_bitset/dynamic_bitset.html (original)
+++ trunk/libs/dynamic_bitset/dynamic_bitset.html 2008-07-13 13:55:45 EDT (Sun, 13 Jul 2008)
@@ -1,14 +1,16 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
 
 <!--
- (C) Jeremy Siek 2001.
- (C) Gennaro Prota 2003-2004.
+ Copyright (c) 2001 Jeremy Siek
+ Copyright (c) 2003-2004, 2008 Gennaro Prota
 
        Distributed under the Boost Software License, Version 1.0.
           (See accompanying file LICENSE_1_0.txt or copy at
                 http://www.boost.org/LICENSE_1_0.txt)
- -->
+-->
 
 <!--
    Copyright (c) 1996-1999
@@ -36,64 +38,46 @@
   -->
 <head>
 <title>dynamic_bitset&lt;Block, Allocator&gt;</title>
+<link rel="stylesheet" type="text/css" href="../../rst.css" />
 </head>
-<body text="#000000" link="#006600" alink="#003300"
- vlink="#7C7F87" bgcolor="#FFFFFF">
-<img src="../../boost.png" alt="boost.png (6897 bytes)"
-align="middle" width="277" height="86">
 
-<p><!--end header-->
-<br>
-</p>
+<body>
+<div id="body">
+<div id="body-inner">
+<div id="content">
+<div class="section" id="docs">
+<div class="section-0">
+<div class="section-body">
 
+<div id="boost-logo"><img src="../../boost.png" alt="Boost C++ Libraries" /></div>
 <h1>dynamic_bitset&lt;Block, Allocator&gt;</h1>
-
 <h2>Contents</h2>
 
 <dl class="index">
 <dt>Description</dt>
-
 <dt>Synopsis</dt>
-
 <dt>Definitions</dt>
-
 <dt>Examples</dt>
-
 <dt>Rationale</dt>
-
 <dt>Header Files</dt>
-
 <dt>Template Parameters</dt>
-
 <dt>Concepts modeled</dt>
 
 <dt>Type requirements</dt>
-
 <dt>Public base classes</dt>
-
 <dt>Nested type names</dt>
-
 <dt>Public data members</dt>
-
 <dt>Constructors</dt>
-
 <dt>Destructor</dt>
-
 <dt>Member functions</dt>
-
 <dt>Non-member functions</dt>
-
 <dt>Exception guarantees</dt>
 
 <dt>Changes from previous version(s)</dt>
-
 <dt>See also</dt>
-
 <dt>Acknowledgements</dt>
 </dl>
-
-<h3><a name="description">Description</a></h3>
-
+<h3><a id="description">Description</a></h3>
 <p>The <tt>dynamic_bitset</tt> class represents a set of bits. It
 provides accesses to the value of individual bits via an
 <tt>operator[]</tt> and provides all of the bitwise operators
@@ -118,9 +102,7 @@
 <tt>dynamic_bitset</tt>, such as <tt>operator&amp;</tt> and
 <tt>operator|</tt>, correspond to set operations, such as
 intersection and union.</p>
-
-<h3><a name="synopsis">Synopsis</a></h3>
-
+<h3><a id ="synopsis">Synopsis</a></h3>
 <pre>
 namespace boost {
 
@@ -140,6 +122,7 @@
     class reference
     {
         void operator&amp;(); // not defined
+
     public:
         // An automatically generated copy constructor.
 
@@ -155,6 +138,7 @@
         operator bool() const;
         reference&amp; flip();
     };
+
     typedef bool const_reference;
 
     explicit <a href=
@@ -191,29 +175,20 @@
     void clear();
     void push_back(bool bit);
     void append(Block block);
+
     template &lt;typename BlockInputIterator&gt;
- void <a href=
-"#append2">append</a>(BlockInputIterator first, BlockInputIterator last);
+ void append(BlockInputIterator first, BlockInputIterator last);
 
- dynamic_bitset&amp; <a href=
-"#op-and-assign">operator&amp;=</a>(const dynamic_bitset&amp; b);
- dynamic_bitset&amp; <a href=
-"#op-or-assign">operator|=</a>(const dynamic_bitset&amp; b);
- dynamic_bitset&amp; <a href=
-"#op-xor-assign">operator^=</a>(const dynamic_bitset&amp; b);
- dynamic_bitset&amp; <a href=
-"#op-sub-assign">operator-=</a>(const dynamic_bitset&amp; b);
- dynamic_bitset&amp; <a href=
-"#op-sl-assign">operator&lt;&lt;=</a>(size_type n);
- dynamic_bitset&amp; <a href=
-"#op-sr-assign">operator&gt;&gt;=</a>(size_type n);
- dynamic_bitset <a href=
-"#op-sl">operator&lt;&lt;</a>(size_type n) const;
- dynamic_bitset <a href=
-"#op-sr">operator&gt;&gt;</a>(size_type n) const;
+ dynamic_bitset&amp; operator&=(const dynamic_bitset&amp; b);
+ dynamic_bitset&amp; operator|=(const dynamic_bitset&amp; b);
+ dynamic_bitset&amp; operator^=(const dynamic_bitset&amp; b);
+ dynamic_bitset&amp; operator-=(const dynamic_bitset&amp; b);
+ dynamic_bitset&amp; operator<<=(size_type n);
+ dynamic_bitset&amp; operator>>=(size_type n);
+ dynamic_bitset operator<<(size_type n) const;
+ dynamic_bitset operator>>(size_type n) const;
 
- dynamic_bitset&amp; <a href=
-"#set2">set</a>(size_type n, bool val = true);
+ dynamic_bitset&amp; set(size_type n, bool val = true);
     dynamic_bitset&amp; set();
     dynamic_bitset&amp; reset(size_type n);
     dynamic_bitset&amp; reset();
@@ -225,10 +200,8 @@
     dynamic_bitset operator~() const;
     size_type count() const;
 
- reference <a href=
-"#bracket">operator[]</a>(size_type pos);
- bool <a href=
-"#const-bracket">operator[]</a>(size_type pos) const;
+ reference operator[](size_type pos);
+ bool operator[](size_type pos) const;
 
     unsigned long to_ulong() const;
 
@@ -237,18 +210,15 @@
     size_type max_size() const;
     bool empty() const;
 
- bool <a href=
-"#is_subset_of">is_subset_of</a>(const dynamic_bitset&amp; a) const;
- bool <a href=
-"#is_proper_subset_of">is_proper_subset_of</a>(const dynamic_bitset&amp; a) const;
+ bool is_subset_of(const dynamic_bitset&amp; a) const;
+ bool is_proper_subset_of(const dynamic_bitset&amp; a) const;
 
     size_type find_first() const;
     size_type find_next(size_type pos) const;
 
-
-
 };
 
+
 template &lt;typename B, typename A&gt;
 bool <a href=
 "#op-equal">operator==</a>(const dynamic_bitset&lt;B, A&gt;&amp; a, const dynamic_bitset&lt;B, A&gt;&amp; b);
@@ -316,7 +286,7 @@
 } // namespace boost
 </pre>
 
-<h3><a name="definitions">Definitions</a></h3>
+<h3><a id="definitions">Definitions</a></h3>
 
 <p>Each bit represents either the Boolean value true or false (1
 or 0). To <i>set</i> a bit is to assign it 1. To <i>clear</i> or
@@ -331,135 +301,31 @@
 unsigned long <tt>n</tt>, the bit at position <tt>i</tt> of the
 bitset has the same value as <tt>(n &gt;&gt; i) &amp; 1</tt>.</p>
 
-<h3><a name="examples">Examples</a></h3>
-
-<p>An example of setting and reading some bits. Note that
-<tt>operator[]</tt> goes from the least-significant bit at
-<tt>0</tt> to the most significant bit at <tt>size()-1</tt>. The
-<tt>operator&lt;&lt;</tt> for <tt>dynamic_bitset</tt> prints the
-bitset from most-significant to least-significant, since that is
-the format most people are use to reading.</p>
-
-<blockquote>
-<pre>
-#include &lt;iostream&gt;
-#include &lt;boost/dynamic_bitset.hpp&gt;
-int main(int, char*[]) {
- boost::dynamic_bitset&lt;&gt; x(5); // all 0's by default
- x[0] = 1;
- x[1] = 1;
- x[4] = 1;
- for (boost::dynamic_bitset&lt;&gt;::size_type i = 0; i &lt; x.size(); ++i)
- std::cout &lt;&lt; x[i];
- std::cout &lt;&lt; "\n";
- std::cout &lt;&lt; x &lt;&lt; "\n";
- return EXIT_SUCCESS;
-}
-</pre>
-</blockquote>
-
-<p>The output is</p>
-
-<blockquote>
-<pre>
-11001
-10011
-</pre>
-</blockquote>
-
-<p>An example of creating some bitsets from integers (unsigned
-longs).</p>
-
-<blockquote>
-<pre>
-#include &lt;iostream&gt;
-#include &lt;boost/dynamic_bitset.hpp&gt;
-int main(int, char*[])
-{
- const boost::dynamic_bitset&lt;&gt; b0(2, 0ul);
- std::cout &lt;&lt; "bits(0) = " &lt;&lt; b0 &lt;&lt; std::endl;
-
- const boost::dynamic_bitset&lt;&gt; b1(2, 1ul);
- std::cout &lt;&lt; "bits(1) = " &lt;&lt; b1 &lt;&lt; std::endl;
-
- const boost::dynamic_bitset&lt;&gt; b2(2, 2ul);
- std::cout &lt;&lt; "bits(2) = " &lt;&lt; b2 &lt;&lt; std::endl;
-
- const boost::dynamic_bitset&lt;&gt; b3(2, 3ul);
- std::cout &lt;&lt; "bits(3) = " &lt;&lt; b3 &lt;&lt; std::endl;
-
- return EXIT_SUCCESS;
-}
-</pre>
-</blockquote>
-
-<p>The output is</p>
-
-<blockquote>
-<pre>
-bits(0) = 00
-bits(1) = 01
-bits(2) = 10
-bits(3) = 11
-</pre>
-</blockquote>
-
-<p>An example of performing some bitwise operations.</p>
-
-<blockquote>
-<pre>
-#include &lt;iostream&gt;
-#include &lt;boost/dynamic_bitset.hpp&gt;
-int main(int, char*[]) {
- const boost::dynamic_bitset&lt;&gt; mask(12, 2730ul);
- std::cout &lt;&lt; "mask = " &lt;&lt; mask &lt;&lt; std::endl;
-
- boost::dynamic_bitset&lt;&gt; x(12);
-
- std::cout &lt;&lt; "Enter a 12-bit bitset in binary: " &lt;&lt; std::flush;
- if (std::cin &gt;&gt; x) {
- std::cout &lt;&lt; "input number: " &lt;&lt; x &lt;&lt; std::endl;
- std::cout &lt;&lt; "As unsigned long: " &lt;&lt; x.to_ulong() &lt;&lt; std::endl;
- std::cout &lt;&lt; "And with mask: " &lt;&lt; (x &amp; mask) &lt;&lt; std::endl;
- std::cout &lt;&lt; "Or with mask: " &lt;&lt; (x | mask) &lt;&lt; std::endl;
- std::cout &lt;&lt; "Shifted left: " &lt;&lt; (x &lt;&lt; 1) &lt;&lt; std::endl;
- std::cout &lt;&lt; "Shifted right: " &lt;&lt; (x &gt;&gt; 1) &lt;&lt; std::endl;
- }
- return EXIT_SUCCESS;
-}
-</pre>
-</blockquote>
-
-<p>The output is</p>
-
-<blockquote>
-<pre>
-mask = 101010101010
-Enter a 12-bit bitset in binary: 100110101101
-input number = 100110101101
-As unsigned long: 2477
-And with mask: 100010101000
-Or with mask: 101110101111
-Shifted left: 001101011010
-Shifted right: 010011010110
-</pre>
-</blockquote>
+<h3><a id="examples">Examples</a></h3>
 
-<h3><a name="rationale">Rationale</a></h3>
+<p>
+Example 1 (setting
+and reading some bits)
+</p>
+<p>
+Example 2 (creating
+some bitsets from integers)
+</p>
 
-The <tt>dynamic_bitset</tt> does not provide iterators (and
-therefore is not a <a href=
-"http://www.sgi.com/tech/stl/Container.html">Container</a>) for
-the following reasons:
+<p>
+Example 3 (performing
+input/output and some bitwise operations).
+</p>
 
-<ol>
-<li><tt>std::bitset</tt> does not have iterators, and
-<tt>dynamic_bitset</tt> is meant to be a run-time sized version
-of <tt>std::bitset</tt>.</li>
 
-<li>The <tt>dynamic_bitset</tt> is not designed to be a <a href=
-"http://www.sgi.com/tech/stl/Container.html">Container</a>.</li>
+<h3><a id="rationale">Rationale</a></h3>
+<p>
+<tt>dynamic_bitset</tt> is not a <a href=
+"http://www.sgi.com/tech/stl/Container.html">Container</a> and
+does not provide iterators for the following reason:
+</p>
 
+<ul>
 <li>A container with a proxy <tt>reference</tt> type can not
 fulfill the container requirements as specified in the C++
 standard (unless one resorts to strange iterator semantics).
@@ -478,7 +344,7 @@
 discussion of the problem see <i>Effective STL</i> by Scott
 Meyers). So <tt>dynamic_bitset</tt> tries to avoid these problems
 by not pretending to be a container.</li>
-</ol>
+</ul>
 
 <p>Some people prefer the name "toggle" to "flip". The name
 "flip" was chosen because that is the name used in <a href=
@@ -492,7 +358,7 @@
 "http://www.boost.org/more/error_handling.html">Error and Exception Handling</a>
 for the explanation.</p>
 
-<h3><a name="header-files">Header Files</a></h3>
+<h3><a id="header-files">Header Files</a></h3>
 
 <p>The class <tt>dynamic_bitset</tt> is defined in the header <a
 href=
@@ -501,33 +367,28 @@
 in the header <a href=
 "../../boost/dynamic_bitset_fwd.hpp">boost/dynamic_bitset_fwd.hpp</a>.</p>
 
-<h3><a name="template-parameters">Template parameters</a></h3>
+<h3><a id="template-parameters">Template parameters</a></h3>
 
-<table border summary=
+<table summary=
 "Describes the meaning of the template parameters and lists their corresponding default arguments">
 <tr>
 <th>Parameter</th>
 <th>Description</th>
 <th>Default</th>
 </tr>
-
 <tr>
-<td valign="top"><tt>Block</tt> </td>
-<td valign="top">The integer type in which the bits are
-stored.</td>
-<td valign="top"><tt>unsigned long</tt> </td>
+<td><tt>Block</tt></td>
+<td>The integer type in which the bits are stored.</td>
+<td><tt>unsigned long</tt></td>
 </tr>
-
 <tr>
-<td valign="top"><tt>Allocator</tt> </td>
-<td valign="top">The allocator type used for all internal memory
-management.</td>
-<td valign="top"><tt>std::allocator&lt;Block&gt;</tt> </td>
+
+<td><tt>Allocator</tt></td>
+<td>The allocator type used for all internal memory management.</td>
+<td><tt>std::allocator&lt;Block&gt;</tt></td>
 </tr>
 </table>
-
-<h3><a name="concepts-modeled">Concepts Modeled</a></h3>
-
+<h3><a id="concepts-modeled">Concepts Modeled</a></h3>
 <a href=
 "http://www.sgi.com/tech/stl/Assignable.html">Assignable</a>, <a
 href=
@@ -538,20 +399,19 @@
 "http://www.sgi.com/tech/stl/LessThanComparable.html">LessThan
 Comparable</a>.
 
-<h3><a name="type-requirements">Type requirements</a></h3>
+<h3><a id="type-requirements">Type requirements</a></h3>
 
 <tt>Block</tt> is an unsigned integer type. <tt>Allocator</tt>
 satisfies the Standard requirements for an allocator.
 
-<h3><a name="public-base-classes">Public base classes</a></h3>
+<h3><a id="public-base-classes">Public base classes</a></h3>
 
 None.
+<h3><a id="nested-type-names">Nested type names</a></h3>
+<hr />
 
-<h3><a name="nested-type-names">Nested type names</a></h3>
-
-<hr>
 <pre>
-<a name="reference">dynamic_bitset::reference</a>
+<a id="reference">dynamic_bitset::reference</a>
 </pre>
 
 <p>A proxy class that acts as a reference to a single bit. It
@@ -572,29 +432,24 @@
 <th>Expression</th>
 <th>Semantics</th>
 </tr>
-
 <tr>
 <td><tt>x = b[i]</tt></td>
 <td>Assign the ith bit of <tt>b</tt> to <tt>x</tt>.</td>
 </tr>
-
 <tr>
 <td><tt>(bool)b[i]</tt></td>
 <td>Return the ith bit of <tt>b</tt>.</td>
 </tr>
-
 <tr>
 <td><tt>b[i] = x</tt></td>
 <td>Set the ith bit of <tt>b</tt> to the value of <tt>x</tt> and
 return <tt>b[i]</tt>.</td>
 </tr>
-
 <tr>
 <td><tt>b[i] |= x</tt></td>
 <td>Or the ith bit of <tt>b</tt> with the value of <tt>x</tt> and
 return <tt>b[i]</tt>.</td>
 </tr>
-
 <tr>
 <td><tt>b[i] &amp;= x</tt></td>
 <td>And the ith bit of <tt>b</tt> with the value of <tt>x</tt>
@@ -627,109 +482,92 @@
 
 <tr>
 <td><tt>b[i] &amp;= b[j]</tt></td>
-<td>And the ith bit of <tt>b</tt> with the jth bit of <tt>b</tt>
-and return <tt>b[i]</tt>.</td>
+<td>And the ith bit of <tt>b</tt> with the jth bit of <tt>b</tt> and return <tt>b[i]</tt>.</td>
 </tr>
-
 <tr>
 <td><tt>b[i] ^= b[j]</tt></td>
-<td>Exclusive-Or the ith bit of <tt>b</tt> with the jth bit of
-<tt>b</tt> and return <tt>b[i]</tt>.</td>
-</tr>
+<td>Exclusive-Or the ith bit of <tt>b</tt> with the jth bit of <tt>b</tt> and return <tt>b[i]</tt>.</td>
 
+</tr>
 <tr>
 <td><tt>b[i] -= b[j]</tt></td>
-<td>If the jth bit of <tt>b</tt> is set, clear the ith bit of
-<tt>b</tt>. Returns <tt>b[i]</tt>.</td>
+<td>If the jth bit of <tt>b</tt> is set, clear the ith bit of <tt>b</tt>. Returns <tt>b[i]</tt>.</td>
 </tr>
-
 <tr>
 <td><tt>x = ~b[i]</tt></td>
-<td>Assign the opposite of the ith bit of <tt>b</tt> to
-<tt>x</tt>.</td>
-</tr>
 
+<td>Assign the opposite of the ith bit of <tt>b</tt> to <tt>x</tt>.</td>
+</tr>
 <tr>
 <td><tt>(bool)~b[i]</tt></td>
 <td>Return the opposite of the ith bit of <tt>b</tt>.</td>
 </tr>
-
 <tr>
-<td><tt>b[i].flip()</tt> </td>
+
+<td><tt>b[i].flip()</tt></td>
 <td>Flip the ith bit of <tt>b</tt> and return <tt>b[i]</tt>.</td>
 </tr>
 </table>
-
-<hr>
+<hr />
 <pre>
-<a name="const_reference">dynamic_bitset::const_reference</a>
+<a id="const_reference">dynamic_bitset::const_reference</a>
 </pre>
-
 The type <tt>bool</tt>.
 
-<hr>
 <pre>
-<a name="size_type">dynamic_bitset::size_type</a>
+<a id="size_type">dynamic_bitset::size_type</a>
 </pre>
-
 The unsigned integer type for representing the size of the bit set.
 
-<hr>
 <pre>
-<a name="block_type">dynamic_bitset::block_type</a>
+<a id="block_type">dynamic_bitset::block_type</a>
 </pre>
-
 The same type as <tt>Block</tt>.
 
-<hr>
 <pre>
-<a name="allocator_type">dynamic_bitset::allocator_type;</a>
+<a id="allocator_type">dynamic_bitset::allocator_type;</a>
 </pre>
-
 The same type as <tt>Allocator</tt>.
 
-<hr>
-<h3><a name="public-data-members">Public data members</a></h3>
 
-<hr>
+<hr />
+<h3><a id="public-data-members">Public data members</a></h3>
+
 <pre>
-<a name="bits_per_block">dynamic_bitset::bits_per_block</a>
+<a id="bits_per_block">dynamic_bitset::bits_per_block</a>
 </pre>
-
 The number of bits the type <tt>Block</tt> uses to represent values,
 excluding any padding bits. Numerically equal
 to <tt>std::numeric_limits&lt;Block&gt;::digits</tt>.
 
-<hr>
 <pre>
-<a name="npos">dynamic_bitset::npos</a>
+<a id="npos">dynamic_bitset::npos</a>
 </pre>
-
 The maximum value of <tt>size_type</tt>.
 
-<hr>
-<h3><a name="constructors">Constructors</a></h3>
+<hr />
+<h3><a id="constructors">Constructors</a></h3>
 
-<hr>
+<hr />
 <pre>
-<a name=
+<a id=
 "cons1">dynamic_bitset</a>(const Allocator&amp; alloc = Allocator())
 </pre>
 
 <b>Effects:</b> Constructs a bitset of size zero. A copy of the
 <tt>alloc</tt> object will be used in subsequent bitset
-operations such as <tt>resize</tt> to allocate memory.<br>
- <b>Postconditions:</b> <tt>this-&gt;size() == 0</tt>.<br>
+operations such as <tt>resize</tt> to allocate memory.<br />
+ <b>Postconditions:</b> <tt>this-&gt;size() == 0</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
  (Required by <a href=
 "http://www.sgi.com/tech/stl/DefaultConstructible.html">Default
 Constructible</a>.)
 
-<hr>
+<hr />
 <pre>
-<a name="cons2">dynamic_bitset</a>(size_type num_bits,
+<a id="cons2">dynamic_bitset</a>(size_type num_bits,
                unsigned long value = 0,
                const Allocator&amp; alloc = Allocator())
 </pre>
@@ -739,7 +577,7 @@
 <tt>val</tt> and all other bits, if any, to zero (where <tt>M =
 min(num_bits, std::numeric_limits&lt;unsigned long&gt;::digits)</tt>). A copy of
 the <tt>alloc</tt> object will be used in subsequent bitset
-operations such as <tt>resize</tt> to allocate memory.<br>
+operations such as <tt>resize</tt> to allocate memory.<br />
  <b>Postconditions:</b>
 
 <ul>
@@ -754,30 +592,30 @@
 
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
 
 
-<hr>
+<hr />
 <pre>
-<a name="cons5">dynamic_bitset</a>(const dynamic_bitset&amp; x)
+<a id="cons5">dynamic_bitset</a>(const dynamic_bitset&amp; x)
 </pre>
 
 <b>Effects:</b> Constructs a bitset that is a copy of the bitset
 <tt>x</tt>. The allocator for this bitset is a copy of the
-allocator in <tt>x</tt>. <br>
+allocator in <tt>x</tt>. <br />
  <b>Postconditions:</b> For all <tt>i</tt> in the range
-<tt>[0,x.size())</tt>, <tt>(*this)[i] == x[i]</tt>.<br>
+<tt>[0,x.size())</tt>, <tt>(*this)[i] == x[i]</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
  (Required by <a href=
 "http://www.sgi.com/tech/stl/Assignable.html">Assignable</a>.)
 
-<hr>
+<hr />
 <pre>
 template &lt;typename BlockInputIterator&gt;
 explicit
-<a name=
+<a id=
 "cons4">dynamic_bitset</a>(BlockInputIterator first, BlockInputIterator last,
                const Allocator&amp; alloc = Allocator());
 </pre>
@@ -790,22 +628,22 @@
 number <tt>b</tt> with value <tt>bval</tt>, the bit <tt>(bval
 &gt;&gt; i) &amp; 1</tt> corresponds to the bit at position
 <tt>(b * bits_per_block + i)</tt> in the bitset (where <tt>i</tt>
-goes through the range <tt>[0, bits_per_block)</tt>).<br>
+goes through the range <tt>[0, bits_per_block)</tt>).<br />
  <b>Requires:</b> The type <tt>BlockInputIterator</tt> must be a
 model of <a href=
 "http://www.sgi.com/tech/stl/InputIterator.html">Input
 Iterator</a> and its <tt>value_type</tt> must be the same type as
-<tt>Block</tt>.<br>
+<tt>Block</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
 
 
-<hr>
+<hr />
 <pre>
 template&lt;typename Char, typename Traits, typename Alloc&gt;
 explicit
-<a name="cons3">dynamic_bitset</a>(const <a href=
+<a id="cons3">dynamic_bitset</a>(const <a href=
 "http://www.sgi.com/tech/stl/basic_string.html">std::basic_string</a>&lt;Char,Traits,Alloc&gt;&amp; s,
                typename std::basic_string&lt;CharT, Traits, Alloc&gt;::size_type pos = 0,
                typename std::basic_string&lt;CharT, Traits, Alloc&gt;::size_type n = <a
@@ -816,7 +654,7 @@
 
 <b>Precondition:</b> <tt>pos &lt;= s.size()</tt> and the
 characters used to initialize the bits must be <tt>0</tt> or
-<tt>1</tt>.<br>
+<tt>1</tt>.<br />
  <b>Effects:</b> Constructs a bitset from a string of 0's and
 1's. The first <tt>M</tt> bits are initialized to the
 corresponding characters in <tt>s</tt>, where <tt>M =
@@ -825,61 +663,61 @@
 the least significant bit. That is, character position <tt>pos +
 M - 1 - i</tt> corresponds to bit <tt>i</tt>. So, for example,
 <tt>dynamic_bitset(string("1101"))</tt> is the same as
-<tt>dynamic_bitset(13ul)</tt>.<br>
+<tt>dynamic_bitset(13ul)</tt>.<br />
  <b>Throws:</b> an allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
-<h3><a name="destructor">Destructor</a></h3>
+<hr />
+<h3><a id="destructor">Destructor</a></h3>
 
-<hr>
+<hr />
 <pre>
 ~dynamic_bitset()
 </pre>
 
 <b>Effects:</b> Releases the memory associated with this bitset
-and destroys the bitset object itself.<br>
+and destroys the bitset object itself.<br />
  <b>Throws:</b> nothing.
 
-<hr>
-<h3><a name="member-functions">Member Functions</a></h3>
+<hr />
+<h3><a id="member-functions">Member Functions</a></h3>
 
-<hr>
+<hr />
 <pre>
-void <a name="swap">swap</a>(dynamic_bitset&amp; b);
+void <a id="swap">swap</a>(dynamic_bitset&amp; b);
 </pre>
 
 <b>Effects:</b> The contents of this bitset and bitset <tt>b</tt>
-are exchanged.<br>
+are exchanged.<br />
 <b>Postconditions:</b> This bitset is equal to the original
 <tt>b</tt>, and <tt>b</tt> is equal to the previous version of
-this bitset.<br>
+this bitset.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "assign">operator=</a>(const dynamic_bitset&amp; x)
 </pre>
 
 <b>Effects:</b> This bitset becomes a copy of the bitset
-<tt>x</tt>.<br>
+<tt>x</tt>.<br />
  <b>Postconditions:</b> For all <tt>i</tt> in the range
-<tt>[0,x.size())</tt>, <tt>(*this)[i] == x[i]</tt>.<br>
- <b>Returns:</b> <tt>*this</tt>.<br>
- <b>Throws:</b> nothing. <br>
+<tt>[0,x.size())</tt>, <tt>(*this)[i] == x[i]</tt>.<br />
+ <b>Returns:</b> <tt>*this</tt>.<br />
+ <b>Throws:</b> nothing. <br />
 (Required by <a href=
 "http://www.sgi.com/tech/stl/Assignable.html">Assignable</a>.)
 
-<hr>
+<hr />
 <pre>
-allocator_type <a name="get_allocator">get_allocator()</a> const;
+allocator_type <a id="get_allocator">get_allocator()</a> const;
 </pre>
  <b>Returns:</b> A copy of the allocator object used to construct <tt>*this</tt>.
 
-<hr>
+<hr />
 <pre>
-void <a name=
+void <a id=
 "resize">resize</a>(size_type num_bits, bool value = false);
 </pre>
 
@@ -889,36 +727,36 @@
 <tt>[size(),num_bits)</tt> are all set to <tt>value</tt>. If
 <tt>num_bits &lt; size()</tt> then the bits in the range
 <tt>[0,num_bits)</tt> stay the same (and the remaining bits are
-discarded).<br>
- <b>Postconditions:</b> <tt>this-&gt;size() == num_bits</tt>.<br>
+discarded).<br />
+ <b>Postconditions:</b> <tt>this-&gt;size() == num_bits</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
 
 
-<hr>
+<hr />
 <pre>
-void <a name="clear">clear</a>()
+void <a id="clear">clear</a>()
 </pre>
 
-<b>Effects:</b> The size of the bitset becomes zero.<br>
+<b>Effects:</b> The size of the bitset becomes zero.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-void <a name="push_back">push_back</a>(bool value);
+void <a id="push_back">push_back</a>(bool value);
 </pre>
 
 <b>Effects:</b> Increases the size of the bitset by one, and sets
-the value of the new most-significant bit to <tt>value</tt>.<br>
+the value of the new most-significant bit to <tt>value</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
 
 
-<hr>
+<hr />
 <pre>
-void <a name="append1">append</a>(Block value);
+void <a id="append1">append</a>(Block value);
 </pre>
 
 <b>Effects:</b> Appends the bits in <tt>value</tt> to the bitset
@@ -926,16 +764,16 @@
 the bitset by <tt>bits_per_block</tt>. Let <tt>s</tt> be the old
 size of the bitset, then for <tt>i</tt> in the range
 <tt>[0,bits_per_block)</tt>, the bit at position <tt>(s + i)</tt>
-is set to <tt>((value &gt;&gt; i) &amp; 1)</tt>.<br>
+is set to <tt>((value &gt;&gt; i) &amp; 1)</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
 
 
-<hr>
+<hr />
 <pre>
 template &lt;typename BlockInputIterator&gt;
-void <a name=
+void <a id=
 "append2">append</a>(BlockInputIterator first, BlockInputIterator last);
 </pre>
 
@@ -951,19 +789,19 @@
 model of <a href=
 "http://www.sgi.com/tech/stl/InputIterator.html">Input
 Iterator</a> and the <tt>value_type</tt> must be the same type as
-<tt>Block</tt>.<br>
+<tt>Block</tt>.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if
-<tt>Allocator=std::allocator</tt>).<br>
+<tt>Allocator=std::allocator</tt>).<br />
 
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "op-and-assign">operator&amp;=</a>(const dynamic_bitset&amp; rhs)
 </pre>
 
-<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br>
+<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br />
  <b>Effects:</b> Bitwise-AND all the bits in <tt>rhs</tt> with
 the bits in this bitset. This is equivalent to:
 
@@ -972,16 +810,16 @@
   (*this)[i] = (*this)[i] &amp; rhs[i];
 </pre>
 
-<b>Returns:</b> <tt>*this</tt>.<br>
+<b>Returns:</b> <tt>*this</tt>.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "op-or-assign">operator|=</a>(const dynamic_bitset&amp; rhs)
 </pre>
 
-<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br>
+<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br />
  <b>Effects:</b> Bitwise-OR's all the bits in <tt>rhs</tt> with
 the bits in this bitset. This is equivalent to:
 
@@ -990,16 +828,16 @@
   (*this)[i] = (*this)[i] | rhs[i];
 </pre>
 
-<b>Returns:</b> <tt>*this</tt>.<br>
+<b>Returns:</b> <tt>*this</tt>.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "op-xor-assign">operator^=</a>(const dynamic_bitset&amp; rhs)
 </pre>
 
-<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br>
+<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br />
  <b>Effects:</b> Bitwise-XOR's all the bits in <tt>rhs</tt> with
 the bits in this bitset. This is equivalent to:
 
@@ -1008,16 +846,16 @@
   (*this)[i] = (*this)[i] ^ rhs[i];
 </pre>
 
-<b>Returns:</b> <tt>*this</tt>.<br>
+<b>Returns:</b> <tt>*this</tt>.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "op-sub-assign">operator-=</a>(const dynamic_bitset&amp; rhs)
 </pre>
 
-<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br>
+<b>Requires:</b> <tt>this-&gt;size() == rhs.size()</tt>.<br />
  <b>Effects:</b> Computes the set difference of this bitset and
 the <tt>rhs</tt> bitset. This is equivalent to:
 
@@ -1026,213 +864,207 @@
   (*this)[i] = (*this)[i] &amp;&amp; !rhs[i];
 </pre>
 
-<b>Returns:</b> <tt>*this</tt>.<br>
+<b>Returns:</b> <tt>*this</tt>.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "op-sl-assign">operator&lt;&lt;=</a>(size_type n)
 </pre>
 
 <b>Effects:</b> Shifts the bits in this bitset to the left by
 <tt>n</tt> bits. For each bit in the bitset, the bit at position
 pos takes on the previous value of the bit at position <tt>pos -
-n</tt>, or zero if no such bit exists.<br>
- <b>Returns:</b> <tt>*this</tt>.<br>
+n</tt>, or zero if no such bit exists.<br />
+ <b>Returns:</b> <tt>*this</tt>.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "op-sr-assign">operator&gt;&gt;=</a>(size_type n)
 </pre>
 
 <b>Effects:</b> Shifts the bits in this bitset to the right by
 <tt>n</tt> bits. For each bit in the bitset, the bit at position
 <tt>pos</tt> takes on the previous value of bit <tt>pos + n</tt>,
-or zero if no such bit exists.<br>
- <b>Returns:</b> <tt>*this</tt>.<br>
+or zero if no such bit exists.<br />
+ <b>Returns:</b> <tt>*this</tt>.<br />
  <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name=
+dynamic_bitset <a id=
 "op-sl">operator&lt;&lt;</a>(size_type n) const
 </pre>
 
 <b>Returns:</b> a copy of <tt>*this</tt> shifted to the left by
 <tt>n</tt> bits. For each bit in the returned bitset, the bit at
 position pos takes on the value of the bit at position <tt>pos -
-n</tt> of this bitset, or zero if no such bit exists. Note that
-the expression <tt>b &lt;&lt; n</tt> is equivalent to
-constructing a temporary copy of <tt>b</tt> and then using
-<tt>operator&lt;&lt;=</tt>.<br>
+n</tt> of this bitset, or zero if no such bit exists.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name=
+dynamic_bitset <a id=
 "op-sr">operator&gt;&gt;</a>(size_type n) const
 </pre>
 
 <b>Returns:</b> a copy of <tt>*this</tt> shifted to the right by
 <tt>n</tt> bits. For each bit in the returned bitset, the bit at
 position pos takes on the value of the bit at position <tt>pos +
-n</tt> of this bitset, or zero if no such bit exists. Note that
-the expression <tt>b &gt;&gt; n</tt> is equivalent to
-constructing a temporary copy of <tt>b</tt> and then using
-<tt>operator&gt;&gt;=</tt>.<br>
+n</tt> of this bitset, or zero if no such bit exists.<br />
  <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name="set1">set</a>()
+dynamic_bitset&amp; <a id="set1">set</a>()
 </pre>
 
-<b>Effects:</b> Sets every bit in this bitset to 1.<br>
-<b>Returns:</b> <tt>*this</tt><br>
+<b>Effects:</b> Sets every bit in this bitset to 1.<br />
+<b>Returns:</b> <tt>*this</tt><br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name="flip1">flip</a>()
+dynamic_bitset&amp; <a id="flip1">flip</a>()
 </pre>
 
-<b>Effects:</b> Flips the value of every bit in this bitset.<br>
-<b>Returns:</b> <tt>*this</tt><br>
+<b>Effects:</b> Flips the value of every bit in this bitset.<br />
+<b>Returns:</b> <tt>*this</tt><br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name="op-not">operator~</a>() const
+dynamic_bitset <a id="op-not">operator~</a>() const
 </pre>
 
 <b>Returns:</b> a copy of <tt>*this</tt> with all of its bits
-flipped.<br>
+flipped.<br />
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name="reset1">reset</a>()
+dynamic_bitset&amp; <a id="reset1">reset</a>()
 </pre>
 
-<b>Effects:</b> Clears every bit in this bitset.<br>
-<b>Returns:</b> <tt>*this</tt><br>
+<b>Effects:</b> Clears every bit in this bitset.<br />
+<b>Returns:</b> <tt>*this</tt><br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name=
+dynamic_bitset&amp; <a id=
 "set2">set</a>(size_type n, bool val = true)
 </pre>
 
-<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br>
+<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br />
  <b>Effects:</b> Sets bit <tt>n</tt> if <tt>val</tt> is
 <tt>true</tt>, and clears bit <tt>n</tt> if <tt>val</tt> is
-<tt>false</tt>. <br>
+<tt>false</tt>. <br />
  <b>Returns:</b> <tt>*this</tt>
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name="reset2">reset</a>(size_type n)
+dynamic_bitset&amp; <a id="reset2">reset</a>(size_type n)
 </pre>
 
-<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br>
-<b>Effects:</b> Clears bit <tt>n</tt>.<br>
+<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br />
+<b>Effects:</b> Clears bit <tt>n</tt>.<br />
 <b>Returns:</b> <tt>*this</tt>
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset&amp; <a name="flip2">flip</a>(size_type n)
+dynamic_bitset&amp; <a id="flip2">flip</a>(size_type n)
 </pre>
 
-<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br>
-<b>Effects:</b> Flips bit <tt>n</tt>.<br>
+<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br />
+<b>Effects:</b> Flips bit <tt>n</tt>.<br />
 <b>Returns:</b> <tt>*this</tt>
 
-<hr>
+<hr />
 <pre>
-size_type <a name="size">size</a>() const
+size_type <a id="size">size</a>() const
 </pre>
 
-<b>Returns:</b> the number of bits in this bitset.<br>
+<b>Returns:</b> the number of bits in this bitset.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-size_type <a name="num_blocks">num_blocks</a>() const
+size_type <a id="num_blocks">num_blocks</a>() const
 </pre>
 
-<b>Returns:</b> the number of blocks in this bitset.<br>
+<b>Returns:</b> the number of blocks in this bitset.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-size_type <a name="max_size">max_size</a>() const;
+size_type <a id="max_size">max_size</a>() const;
 </pre>
 
 <b>Returns:</b> the maximum size of a <tt>dynamic_bitset</tt>
 object having the same type as <tt>*this</tt>. Note that if
 any <tt>dynamic_bitset</tt> operation causes <tt>size()</tt> to
 exceed <tt>max_size()</tt> then the <i>behavior is undefined</i>.
-<br><br>[The semantics of this function could change slightly
-when lib issue 197 will be closed]<br>
+<br /><br />[The semantics of this function could change slightly
+when lib issue 197 will be closed]<br />
 
-<hr>
+<hr />
 <pre>
-bool <a name="empty">empty</a>() const;
+bool <a id="empty">empty</a>() const;
 </pre>
 
 <b>Returns:</b> <tt>true</tt> if <tt>this->size() == 0</tt>, <tt>false</tt>
 otherwise. <i>Note</i>: not to be confused with <tt>none()</tt>, that has
 different semantics.
 
-<hr>
+<hr />
 <pre>
-size_type <a name="count">count</a>() const
+size_type <a id="count">count</a>() const
 </pre>
 
 <b>Returns:</b> the number of bits in this bitset that are
-set.<br>
+set.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-bool <a name="any">any</a>() const
+bool <a id="any">any</a>() const
 </pre>
 
 <b>Returns:</b> <tt>true</tt> if any bits in this bitset are set,
-and otherwise returns <tt>false</tt>.<br>
+and otherwise returns <tt>false</tt>.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-bool <a name="none">none</a>() const
+bool <a id="none">none</a>() const
 </pre>
 
 <b>Returns:</b> <tt>true</tt> if no bits are set, and otherwise
-returns <tt>false</tt>.<br>
+returns <tt>false</tt>.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-bool <a name="test">test</a>(size_type n) const
+bool <a id="test">test</a>(size_type n) const
 </pre>
 
-<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br>
+<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br />
  <b>Returns:</b> <tt>true</tt> if bit <tt>n</tt> is set and
 <tt>false</tt> is bit <tt>n</tt> is 0.
 
-<hr>
+<hr />
 <pre>
-reference <a name="bracket">operator[]</a>(size_type n)
+reference <a id="bracket">operator[]</a>(size_type n)
 </pre>
 
-<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br>
+<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br />
  <b>Returns:</b> a <tt>reference</tt> to bit <tt>n</tt>. Note
 that <tt>reference</tt> is a proxy class with an assignment
 operator and a conversion to <tt>bool</tt>, which allows you to
@@ -1241,100 +1073,100 @@
 other respects the proxy is not the same as the true reference
 type <tt>bool&amp;</tt>.
 
-<hr>
+<hr />
 <pre>
-bool <a name="const-bracket">operator[]</a>(size_type n) const
+bool <a id="const-bracket">operator[]</a>(size_type n) const
 </pre>
 
-<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br>
+<b>Precondition:</b> <tt>n &lt; this-&gt;size()</tt>.<br />
 <b>Returns:</b> The same as <tt>test(n)</tt>.
 
-<hr>
+<hr />
 <pre>
-unsigned long <a name="to_ulong">to_ulong</a>() const
+unsigned long <a id="to_ulong">to_ulong</a>() const
 </pre>
 
 <b>Returns:</b> The numeric value corresponding to the bits in <tt>*this</tt>.
-<br>
+<br />
 <b>Throws:</b> <tt>std::overflow_error</tt> if that value is too large to
 be represented in an <tt>unsigned long</tt>, i.e. if <tt>*this</tt> has
 any non-zero bit at a position <tt>&gt;=
 std::numeric_limits&lt;unsigned long&gt;::digits</tt>.
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "is_subset_of">is_subset_of</a>(const dynamic_bitset&amp; a) const
 </pre>
 
-<b>Requires:</b> <tt>this-&gt;size() == a.size()</tt><br>
+<b>Requires:</b> <tt>this-&gt;size() == a.size()</tt><br />
 <b>Returns:</b> true if this bitset is a subset of bitset
 <tt>a</tt>. That is, it returns true if, for every bit that is
 set in this bitset, the corresponding bit in bitset <tt>a</tt> is
-also set. Otherwise this function returns false.<br>
+also set. Otherwise this function returns false.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "is_proper_subset_of">is_proper_subset_of</a>(const dynamic_bitset&amp; a) const
 </pre>
 
-<b>Requires:</b> <tt>this-&gt;size() == a.size()</tt><br>
+<b>Requires:</b> <tt>this-&gt;size() == a.size()</tt><br />
 <b>Returns:</b> true if this bitset is a proper subset of bitset
 <tt>a</tt>. That is, it returns true if, for every bit that is
 set in this bitset, the corresponding bit in bitset <tt>a</tt> is
 also set and if <tt>this-&gt;count() &lt; a.count()</tt>.
-Otherwise this function returns false.<br>
+Otherwise this function returns false.<br />
 <b>Throws:</b> nothing.
 
-<hr>
+<hr />
 <pre>
-size_type <a name = "find_first">find_first</a>() const;
+size_type <a id = "find_first">find_first</a>() const;
 </pre>
 
 <b>Returns:</b> the lowest index <tt>i</tt> such as bit <tt>i</tt>
 is set, or <tt>npos</tt> if <tt>*this</tt> has no on bits.
 
-<hr>
+<hr />
 <pre>
-size_type <a name="find_next">find_next</a>(size_type pos) const;
+size_type <a id="find_next">find_next</a>(size_type pos) const;
 </pre>
 
 <b>Returns:</b> the lowest index <tt>i</tt> greater than
 <tt>pos</tt> such as bit <tt>i</tt> is set, or <tt>npos</tt> if
 no such index exists.
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "op-equal">operator==</a>(const dynamic_bitset&amp; rhs) const
 </pre>
 
 <b>Returns:</b> <tt>true</tt> if <tt>this-&gt;size() ==
 rhs.size()</tt> and if for all <tt>i</tt> in the range
 <tt>[0,rhs.size())</tt>, <tt>(*this)[i] == rhs[i]</tt>. Otherwise
-returns <tt>false</tt>.<br>
- <b>Throws:</b> nothing.<br>
+returns <tt>false</tt>.<br />
+ <b>Throws:</b> nothing.<br />
  (Required by <a href=
 "http://www.sgi.com/tech/stl/EqualityComparable.html">Equality
 Comparable</a>.)
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "op-not-equal">operator!=</a>(const dynamic_bitset&amp; rhs) const
 </pre>
 
-<b>Returns:</b> <tt>!((*this) == rhs)</tt><br>
-<b>Throws:</b> nothing.<br>
+<b>Returns:</b> <tt>!((*this) == rhs)</tt><br />
+<b>Throws:</b> nothing.<br />
 (Required by <a href=
 "http://www.sgi.com/tech/stl/EqualityComparable.html">Equality
 Comparable</a>.)
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "op-less">operator&lt;</a>(const dynamic_bitset&amp; rhs) const
 </pre>
 
@@ -1342,116 +1174,104 @@
 less than <tt>rhs</tt>, and returns <tt>false</tt> otherwise.
 (See the description of <a href=
 "http://www.sgi.com/tech/stl/lexicographical_compare.html">lexicographical_compare</a>
-for a definition of lexicographic ordering). <br>
-<b>Throws:</b> nothing.<br>
+for a definition of lexicographic ordering). <br />
+<b>Throws:</b> nothing.<br />
 (Required by <a href=
 "http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
 Comparable</a>.)
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "op-greater">operator&gt;</a>(const dynamic_bitset&amp; rhs) const
 </pre>
 
 <b>Returns:</b> <tt>!((*this) &lt; rhs || (*this) ==
-rhs)</tt><br>
-<b>Throws:</b> nothing.<br>
+rhs)</tt><br />
+<b>Throws:</b> nothing.<br />
 (Required by <a href=
 "http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
 Comparable</a>.)
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "op-less-equal">operator&lt;=</a>(const dynamic_bitset&amp; rhs) const
 </pre>
 
-<b>Returns:</b> <tt>(*this) &lt; rhs || (*this) == rhs</tt><br>
-<b>Throws:</b> nothing.<br>
+<b>Returns:</b> <tt>(*this) &lt; rhs || (*this) == rhs</tt><br />
+<b>Throws:</b> nothing.<br />
 (Required by <a href=
 "http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
 Comparable</a>.)
 
-<hr>
+<hr />
 <pre>
-bool <a name=
+bool <a id=
 "op-greater-equal">operator&gt;=</a>(const dynamic_bitset&amp; rhs) const
 </pre>
 
-<b>Returns:</b> <tt>(*this) &gt; rhs || (*this) == rhs</tt><br>
-<b>Throws:</b> nothing.<br>
+<b>Returns:</b> <tt>(*this) &gt; rhs || (*this) == rhs</tt><br />
+<b>Throws:</b> nothing.<br />
 (Required by <a href=
 "http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
 Comparable</a>.)
 
-<hr>
-<h3><a name="non-member-functions">Non-Member Functions</a></h3>
+<hr />
+<h3><a id="non-member-functions">Non-Member Functions</a></h3>
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name=
+dynamic_bitset <a id=
 "op-and">operator&amp;</a>(const dynamic_bitset&amp; a, const dynamic_bitset&amp; b)
 </pre>
 
-<b>Requires:</b> <tt>a.size() == b.size()</tt><br>
+<b>Requires:</b> <tt>a.size() == b.size()</tt><br />
 <b>Returns:</b> A new bitset that is the bitwise-AND of the
-bitsets <tt>a</tt> and <tt>b</tt>. Note that the expression
-<tt>b1 &amp; b2</tt> is equivalent to creating a temporary copy
-of <tt>b1</tt>, using <tt>operator&amp;=</tt>, and returning the
-temporary copy.<br>
+bitsets <tt>a</tt> and <tt>b</tt>.<br />
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name=
+dynamic_bitset <a id=
 "op-or">operator|</a>(const dynamic_bitset&amp; a, const dynamic_bitset&amp; b)
 </pre>
 
-<b>Requires:</b> <tt>a.size() == b.size()</tt><br>
+<b>Requires:</b> <tt>a.size() == b.size()</tt><br />
 <b>Returns:</b> A new bitset that is the bitwise-OR of the
-bitsets <tt>a</tt> and <tt>b</tt>. Note that the expression
-<tt>b1 &amp; b2</tt> is equivalent to creating a temporary copy
-of <tt>b1</tt>, using <tt>operator&amp;=</tt>, and returning the
-temporary copy.<br>
+bitsets <tt>a</tt> and <tt>b</tt>.<br />
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name=
+dynamic_bitset <a id=
 "op-xor">operator^</a>(const dynamic_bitset&amp; a, const dynamic_bitset&amp; b)
 </pre>
 
-<b>Requires:</b> <tt>a.size() == b.size()</tt><br>
+<b>Requires:</b> <tt>a.size() == b.size()</tt><br />
 <b>Returns:</b> A new bitset that is the bitwise-XOR of the
-bitsets <tt>a</tt> and <tt>b</tt>. Note that the expression
-<tt>b1 &amp; b2</tt> is equivalent to creating a temporary copy
-of <tt>b1</tt>, using <tt>operator&amp;=</tt>, and returning the
-temporary copy.<br>
+bitsets <tt>a</tt> and <tt>b</tt>.<br />
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
-dynamic_bitset <a name=
+dynamic_bitset <a id=
 "op-sub">operator-</a>(const dynamic_bitset&amp; a, const dynamic_bitset&amp; b)
 </pre>
 
-<b>Requires:</b> <tt>a.size() == b.size()</tt><br>
+<b>Requires:</b> <tt>a.size() == b.size()</tt><br />
 <b>Returns:</b> A new bitset that is the set difference of the
-bitsets <tt>a</tt> and <tt>b</tt>. Note that the expression
-<tt>b1 - b2</tt> is equivalent to creating a temporary copy of
-<tt>b1</tt>, using <tt>operator-=</tt>, and returning the
-temporary copy.<br>
+bitsets <tt>a</tt> and <tt>b</tt>.<br />
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 
-<hr>
+<hr />
 <pre>
 template &lt;typename CharT, typename Alloc&gt;
-void <a name=
+void <a id=
 "to_string">to_string</a>(const dynamic_bitset&lt;Block, Allocator&gt;&amp; b,
                <a href=
 "http://www.sgi.com/tech/stl/basic_string.html">std::basic_string</a>&lt;Char,Traits,Alloc&gt;&amp; s)
@@ -1461,9 +1281,9 @@
 string <tt>s</tt>. A character in the string is <tt>'1'</tt> if
 the corresponding bit is set, and <tt>'0'</tt> if it is not.
 Character position <tt>i</tt> in the string corresponds to bit
-position <tt>b.size() - 1 - i</tt>. <br>
+position <tt>b.size() - 1 - i</tt>. <br />
  <b>Throws:</b> If memory is exhausted, the string will throw an
-allocation error.<br>
+allocation error.<br />
  <b>Rationale:</b> This function is not a member function taking
 zero arguments and returning a string for a couple reasons.
 First, this version can be slighly more efficient because the
@@ -1474,10 +1294,10 @@
 are familiar with explicit template parameters, and some C++
 compilers do not handle them properly.
 
-<hr>
+<hr />
 <pre>
 template &lt;typename Block, typename Alloc, typename BlockOutputIterator&gt;
-void <a name=
+void <a id=
 "to_block_range">to_block_range</a>(const dynamic_bitset&lt;Block, Alloc&gt;&amp; b, BlockOutputIterator result)
 </pre>
 
@@ -1489,7 +1309,7 @@
 <tt>[bits_pre_block,2*bits_per_block)</tt>, and so on. For each
 block <tt>bval</tt> written, the bit <tt>(bval &gt;&gt; i) &amp;
 1</tt> corresponds to the bit at position <tt>(b * bits_per_block
-+ i)</tt> in the bitset.<br>
++ i)</tt> in the bitset.<br />
  <b>Requires:</b> The type <tt>BlockOutputIterator</tt> must be a
 model of <a href=
 "http://www.sgi.com/tech/stl/OutputIterator.html">Output
@@ -1497,27 +1317,27 @@
 <tt>Block</tt>. Further, the size of the output range must be
 greater or equal <tt>b.num_blocks()</tt>.
 
-<hr>
+<hr />
 <pre>
 template &lt;typename BlockIterator, typename Block, typename Alloc&gt;
-void <a name=
+void <a id=
 "from_block_range">from_block_range</a>(BlockIterator first,
     BlockIterator last, const dynamic_bitset&lt;Block, Alloc&gt;&amp; b)
 </pre>
 
 <b>Effects:</b> Reads blocks from the iterator range into the
-bitset. <br>
+bitset. <br />
  <b>Requires:</b> The type <tt>BlockIterator</tt> must be a model
 of <a href="http://www.sgi.com/tech/stl/InputIterator.html">Input
 Iterator</a> and its <tt>value_type</tt> must be the same type as
 <tt>Block</tt>. The size of the iterator range must be less or
 equal to <tt>b.num_blocks()</tt>.
 
-<hr>
+<hr />
 <pre>
 template &lt;typename Char, typename Traits, typename Block, typename Alloc&gt;
 basic_ostream&lt;Char, Traits&gt;&amp;
-<a name=
+<a id=
 "op-out">operator&lt;&lt;</a>(basic_ostream&lt;Char, Traits&gt;&amp; os, const dynamic_bitset&lt;Block, Alloc&gt;&amp; b)
 </pre>
 
@@ -1527,7 +1347,7 @@
 <pre>
 std::basic_string&lt;Char, Traits&gt; s;
 boost::to_string(x, s):
-os << s;
+os &lt;&lt; s;
 </pre>
 
 except that the stream inserter takes into accout the locale imbued into
@@ -1546,22 +1366,22 @@
 Then, the output, the effects on <tt>os</tt> and the exception behavior
 is the same as outputting the object <tt>s</tt> to <tt>os</tt> (same
 width, same exception mask, same padding, same setstate() logic)
-<br>
-<b>Returns:</b> os <br>
+<br />
+<b>Returns:</b> os <br />
 <b>Throws:</b> <tt>std::ios_base::failure</tt> if there is a
 problem writing to the stream.
 
-<hr>
+<hr />
 <pre>
 template &lt;typename Char, typename Traits, typename Block, typename Alloc&gt;
 std::basic_istream&lt;Char,Traits&gt;&amp;
-<a name=
+<a id=
 "op-in">operator&gt;&gt;</a>(std::basic_istream&lt;Char,Traits&gt;&amp; is, dynamic_bitset&lt;Block, Alloc&gt;&amp; b)
 </pre>
 
 <b>Effects:</b> Extracts a <tt>dynamic_bitset</tt> from an input stream.
-<br><br>
- <i>Definitions:</i><br><br>
+<br /><br />
+ <i>Definitions:</i><br /><br />
  Let <i>Tr</i> be the traits_type of <i>is</i>. Then:
  <ol>
  <li>
@@ -1588,46 +1408,38 @@
 otherwise <tt>n</tt> = <tt>b.max_size()</tt>.
 
 Unless the extractor is exited via an exception, characters are extracted (and
-corresponding bits appended) until any of the following occurs:<br>
+corresponding bits appended) until any of the following occurs:<br />
 
 <ul>
 <li> <tt>n</tt> bits are stored into the bitset;</li>
 <li> end-of-file, or an error, occurs on the input sequence;</li>
 <li> the next available input character isn't a bitset digit</li>
 </ul>
-<br> If no exception caused the function to exit then <tt>is.width(0)</tt> is
+<br /> If no exception caused the function to exit then <tt>is.width(0)</tt> is
      called, regardless of how many characters were actually extracted. The
      sentry object k is destroyed.
-<br>
-<br>If the function extracts no characters[???], it calls is.setstate(std::ios::failbit),
+<br />
+<br />If the function extracts no characters[???], it calls is.setstate(std::ios::failbit),
      which may throw <tt>std::ios_base::failure</tt>.
 
 
-<br>------
+<br />------
 
 
-<br>
+<br />
 <b>Throws:</b> An allocation error if memory is exhausted
 (<tt>std::bad_alloc</tt> if <tt>Allocator=std::allocator</tt>).
 A <tt>std::ios_base::failure</tt> if there is a problem reading
 from the stream.
 
-<hr>
-<h3><a name="exception-guarantees">Exception guarantees</a></h3>
+<hr />
+<h3><a id="exception-guarantees">Exception guarantees</a></h3>
 
 All of <tt>dynamic_bitset</tt> functions offer at least the basic
-guarantee. In addition some functions offer the strong or the nothrow
-guarantee as summarized in the table below (the destructor, as usual,
-doesn't throw):
-<table summary="" border>
-<tr><td>-</td><td><i>strong</i></td><td><i>nothrow</i></td></tr>
-<tr><td>f</td><td> </td><td><b> x </b></td></tr>
-</table>
-
-
+exception guarantee.
 
-<hr>
-<h3><a name="changes-from-previous-ver">Changes from previous version(s)</a></h3>
+<hr />
+<h3><a id="changes-from-previous-ver">Changes from previous version(s)</a></h3>
 
 <!-- Changes from Boost 1.31.0 -->
 <h4><i>Changes from Boost 1.31.0</i></h4>
@@ -1639,15 +1451,15 @@
 extractor but there are some differences the user should be aware
 of; so, please, look at the documentation.
 (One of the differences concerns the case where
- stream.width() > bitset.max_size() > 0;
-in that circumstance the extractor of dynamic_bitset never attempts to
+<code>stream.width() > bitset.max_size() > 0</code>
+In that circumstance the extractor of dynamic_bitset never attempts to
 extract more than max_size() characters, whereas the extractor of
 basic_string goes on and, on conforming implementations, eventually
 throws a length_error. Note: That's what the standard mandates -see
 especially library issue 83- but not all implementations conform)
-<br><br>
+<br /><br />
 The stream extractor is now also 'exception-aware' in the sense that
-it works correctly when setting exception masks on the stream.<br><br>
+it works correctly when setting exception masks on the stream.<br /><br />
 </li>
 <li>
 Several member functions (<tt>empty()</tt>, <tt>find_first()</tt>
@@ -1672,19 +1484,19 @@
 </li>
 </ul>
 <i>General improvements</i>
-<br><br>
+<br /><br />
 Several optimizations to member and non-member functions and to the
 nested class <tt>reference</tt>.
 
-<hr>
-<h3><a name="see-also">See also</a></h3>
+<hr />
+<h3><a id="see-also">See also</a></h3>
 
 <tt><a href=
 "http://www.sgi.com/tech/stl/bitset.html">std::bitset</a></tt>,
 <tt><a href=
 "http://www.sgi.com/tech/stl/Vector.html">std::vector</a></tt>,
 
-<h3><a name="acknowledgements">Acknowledgements</a></h3>
+<h3><a id="acknowledgements">Acknowledgements</a></h3>
 
 <p>We would like to thank the Boost community for putting in the
 time to review and accept this library. This library is much
@@ -1694,37 +1506,27 @@
 James Kanze for his invaluable help with the internationalization
 issues.</p>
 
-<hr>
-<table summary="">
-<tr>
-<td></td>
-</tr>
-
-<tr valign="top">
-<td nowrap>Copyright &copy; 2001</td>
-<td>Jeremy Siek,
-Indiana University (<a href=
-"mailto:jsiek_at_[hidden]">jsiek_at_[hidden]</a>)<br>
-Chuck Allison, Senior
-Editor, C/C++ Users Journal (<a href=
-"mailto:cda_at_[hidden]">cda_at_[hidden]</a>)<br>
-</td>
-</tr>
-
-<tr valign="top">
-<td nowrap>Copyright &copy; 2003-2004</td>
-<td>Gennaro Prota</td>
+<table summary="Copyright"> <tr> <td>Copyright &copy; 2001</td>
+<td><a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy
+Siek</a>, Indiana University (<a
+href="mailto:jsiek_at_[hidden]">jsiek_at_[hidden]</a>)<br /> <a
+href="http://freshsources.com">Chuck Allison</a>, Senior Editor,
+C/C++ Users Journal (<a
+href="mailto:cda_at_[hidden]">cda_at_[hidden]</a>)<br
+/></td> </tr> <tr>
+<td>Copyright &copy; 2003-2004, 2008</td> <td>Gennaro Prota</td>
 </tr>
 </table>
 
-<!-- LocalWords: dynamic bitset alt gif iostream hpp int bitsets const ul ulong
- -->
-<!-- LocalWords: STL LessThan alloc num typename BlockInputIterator html pos
- -->
-<!-- LocalWords: npos bool rhs OR's XOR's val CharT istream ostream os siek
- -->
-<!-- LocalWords: htm namespace enum sizeof BlockOutputIterator fwd ith jth
- -->
+</div>
+</div>
+</div>
+</div>
+</div>
+</div>
 </body>
+<!-- LocalWords: dynamic bitset alt gif iostream hpp int bitsets const ul ulong -->
+<!-- LocalWords: STL LessThan alloc num typename BlockInputIterator html pos -->
+<!-- LocalWords: npos bool rhs OR's XOR's val CharT istream ostream os siek -->
+<!-- LocalWords: htm namespace enum sizeof BlockOutputIterator fwd ith jth -->
 </html>
-

Modified: trunk/libs/dynamic_bitset/example/example1.cpp
==============================================================================
--- trunk/libs/dynamic_bitset/example/example1.cpp (original)
+++ trunk/libs/dynamic_bitset/example/example1.cpp 2008-07-13 13:55:45 EDT (Sun, 13 Jul 2008)
@@ -3,23 +3,33 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-// Sample output:
-// 1
-// 1
-// 0
-// 0
-// 1
+
+
+// An example of setting and reading some bits. Note that operator[]
+// goes from the least-significant bit at 0 to the most significant
+// bit at size()-1. The operator<< for dynamic_bitset prints the
+// bitset from most-significant to least-significant, since that is
+// the format most people are used to reading.
+//
+// The output is:
+//
+// 11001
+// 10011
+// ---------------------------------------------------------------------
 
 #include <iostream>
 #include <boost/dynamic_bitset.hpp>
-int main() {
- boost::dynamic_bitset<> x(5); // all 0's by default
- x[0] = 1;
- x[1] = 1;
- x[4] = 1;
- for (boost::dynamic_bitset<>::size_type i = 0; i < x.size(); ++i)
- std::cout << x[i];
- std::cout << "\n";
- std::cout << x << "\n";
- return EXIT_SUCCESS;
+
+int main()
+{
+ boost::dynamic_bitset<> x(5); // all 0's by default
+ x[0] = 1;
+ x[1] = 1;
+ x[4] = 1;
+ for (boost::dynamic_bitset<>::size_type i = 0; i < x.size(); ++i)
+ std::cout << x[i];
+ std::cout << "\n";
+ std::cout << x << "\n";
+
+ return 0;
 }

Modified: trunk/libs/dynamic_bitset/example/example2.cpp
==============================================================================
--- trunk/libs/dynamic_bitset/example/example2.cpp (original)
+++ trunk/libs/dynamic_bitset/example/example2.cpp 2008-07-13 13:55:45 EDT (Sun, 13 Jul 2008)
@@ -3,14 +3,17 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //
-// Sample output:
+// Sample output:
+//
 // bits(0) = 00
 // bits(1) = 01
 // bits(2) = 10
 // bits(3) = 11
 
+
 #include <iostream>
 #include <boost/dynamic_bitset.hpp>
+
 int main()
 {
   const boost::dynamic_bitset<> b0(2, 0ul);
@@ -25,5 +28,5 @@
   const boost::dynamic_bitset<> b3(2, 3ul);
   std::cout << "bits(3) = " << b3 << std::endl;
 
- return EXIT_SUCCESS;
+ return 0;
 }

Modified: trunk/libs/dynamic_bitset/example/example3.cpp
==============================================================================
--- trunk/libs/dynamic_bitset/example/example3.cpp (original)
+++ trunk/libs/dynamic_bitset/example/example3.cpp 2008-07-13 13:55:45 EDT (Sun, 13 Jul 2008)
@@ -1,35 +1,70 @@
-// (C) Copyright Jeremy Siek 2001.
+// Copyright (c) 2001 Jeremy Siek
+// Copyright (c) 2008 Gennaro Prota
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 //
-// Sample output:
-// mask = 101010101010
-// Enter a 12-bit bitset in binary: 100110101101
-// x = 100110101101
-// As ulong: 2477
-// And with mask: 100010101000
-// Or with mask: 101110101111
+// Sample run:
+//
+// mask = 101010101010
+// x.size() = 0
+// Enter a bitset in binary: x = 100100010
+//
+// Input number: 100100010
+// x.size() is now: 9
+// As unsigned long: 290
+// Mask (possibly resized): 010101010
+// And with mask: 000100010
+// Or with mask: 110101010
+// Shifted left by 1: 001000100
+// Shifted right by 1: 010010001
+
 
 
+#include <ostream>
 #include <iostream>
 #include <boost/dynamic_bitset.hpp>
 
-int main(int, char*[]) {
- const boost::dynamic_bitset<> mask(12, 2730ul);
- std::cout << "mask = " << mask << std::endl;
-
- boost::dynamic_bitset<> x(12);
- std::cout << "x.size()=" << x.size() << std::endl;
-
- std::cout << "Enter a 12-bit bitset in binary: " << std::flush;
- if (std::cin >> x) {
- std::cout << "input number: " << x << std::endl;
- std::cout << "As unsigned long: " << x.to_ulong() << std::endl;
- std::cout << "And with mask: " << (x & mask) << std::endl;
- std::cout << "Or with mask: " << (x | mask) << std::endl;
- std::cout << "Shifted left: " << (x << 1) << std::endl;
- std::cout << "Shifted right: " << (x >> 1) << std::endl;
- }
- return EXIT_SUCCESS;
+int main()
+{
+ boost::dynamic_bitset<> mask(12, 2730ul);
+ std::cout << "mask = " << mask << std::endl;
+
+ boost::dynamic_bitset<> x;
+ std::cout << "x.size() = " << x.size() << std::endl;
+
+ std::cout << "Enter a bitset in binary: x = " << std::flush;
+ if (std::cin >> x) {
+ const std::size_t sz = x.size();
+ std::cout << std::endl;
+ std::cout << "Input number: " << x << std::endl;
+ std::cout << "x.size() is now: " << sz << std::endl;
+
+ bool fits_in_ulong = true;
+ unsigned long ul = 0;
+ try {
+ ul = x.to_ulong();
+ } catch(std::overflow_error &) {
+ fits_in_ulong = false;
+ }
+
+ std::cout << "As unsigned long: ";
+ if(fits_in_ulong) {
+ std::cout << ul;
+ } else {
+ std::cout << "(overflow exception)";
+ }
+
+ std::cout << std::endl;
+
+ mask.resize(sz);
+
+ std::cout << "Mask (possibly resized): " << mask << std::endl;
+
+ std::cout << "And with mask: " << (x & mask) << std::endl;
+ std::cout << "Or with mask: " << (x | mask) << std::endl;
+ std::cout << "Shifted left by 1: " << (x << 1) << std::endl;
+ std::cout << "Shifted right by 1: " << (x >> 1) << std::endl;
+ }
+ return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk