X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=libstdc%2B%2B-v3%2Fdoc%2Fhtml%2Fmanual%2Fbk01pt12ch33s02.html;fp=libstdc%2B%2B-v3%2Fdoc%2Fhtml%2Fmanual%2Fbk01pt12ch33s02.html;h=03848884170c23dc5be6c3d5baf050ae4452dfb5;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch33s02.html b/libstdc++-v3/doc/html/manual/bk01pt12ch33s02.html new file mode 100644 index 00000000..03848884 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt12ch33s02.html @@ -0,0 +1,43 @@ + + +
+
A few extensions and nods to backwards-compatibility have been made with + containers. Those dealing with older SGI-style allocators are dealt with + elsewhere. The remaining ones all deal with bits: +
The old pre-standard bit_vector
class is present for
+ backwards compatibility. It is simply a typedef for the
+ vector<bool>
specialization.
+
The bitset
class has a number of extensions, described in the
+ rest of this item. First, we'll mention that this implementation of
+ bitset<N>
is specialized for cases where N number of
+ bits will fit into a single word of storage. If your choice of N is
+ within that range (<=32 on i686-pc-linux-gnu, for example), then all
+ of the operations will be faster.
+
There are + versions of single-bit test, set, reset, and flip member functions which + do no range-checking. If we call them member functions of an instantiation + of "bitset<N>," then their names and signatures are: +
+ bitset<N>& _Unchecked_set (size_t pos); + bitset<N>& _Unchecked_set (size_t pos, int val); + bitset<N>& _Unchecked_reset (size_t pos); + bitset<N>& _Unchecked_flip (size_t pos); + bool _Unchecked_test (size_t pos); +
Note that these may in fact be removed in the future, although we have + no present plans to do so (and there doesn't seem to be any immediate + reason to). +
The semantics of member function operator[]
are not specified
+ in the C++ standard. A long-standing defect report calls for sensible
+ obvious semantics, which are already implemented here: op[]
+ on a const bitset returns a bool, and for a non-const bitset returns a
+ reference
(a nested type). However, this implementation does
+ no range-checking on the index argument, which is in keeping with other
+ containers' op[]
requirements. The defect report's proposed
+ resolution calls for range-checking to be done. We'll just wait and see...
+
Finally, two additional searching functions have been added. They return
+ the index of the first "on" bit, and the index of the first
+ "on" bit that is after prev
, respectively:
+
+ size_t _Find_first() const; + size_t _Find_next (size_t prev) const;
The same caveat given for the _Unchecked_* functions applies here also. +