Add test_set() (#6164).

This commit is contained in:
Ahmed Charles
2014-02-24 02:27:45 -08:00
parent 5f4c0dc4d9
commit d19aeced56
4 changed files with 60 additions and 0 deletions

View File

@@ -202,6 +202,7 @@ public:
dynamic_bitset&amp; <a href="#flip2">flip</a>(size_type n);
dynamic_bitset&amp; <a href="#flip1">flip</a>();
bool <a href="#test">test</a>(size_type n) const;
bool <a href="#test">test_set</a>(size_type n, bool val = true);
bool <a href="#all">all</a>() const;
bool <a href="#any">any</a>() const;
bool <a href="#none">none</a>() const;
@@ -1159,6 +1160,18 @@ bool <a id="test">test</a>(size_type n) const
<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 />
<pre>
bool <a id="test">test_set</a>(size_type n, bool val = true)
</pre>
<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 />
<b>Returns:</b> <tt>true</tt> if the previous state of bit
<tt>n</tt> was set and <tt>false</tt> is bit <tt>n</tt> is 0.
<hr />
<pre>
reference <a id="bracket">operator[]</a>(size_type n)