⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bit_vector.html

📁 STL_doc
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML><!--  -- Copyright (c) 1996-1999  -- Silicon Graphics Computer Systems, Inc.  --  -- Permission to use, copy, modify, distribute and sell this software  -- and its documentation for any purpose is hereby granted without fee,  -- provided that the above copyright notice appears in all copies and  -- that both that copyright notice and this permission notice appear  -- in supporting documentation.  Silicon Graphics makes no  -- representations about the suitability of this software for any  -- purpose.  It is provided "as is" without express or implied warranty.  --  -- Copyright (c) 1994  -- Hewlett-Packard Company  --  -- Permission to use, copy, modify, distribute and sell this software  -- and its documentation for any purpose is hereby granted without fee,  -- provided that the above copyright notice appears in all copies and  -- that both that copyright notice and this permission notice appear  -- in supporting documentation.  Hewlett-Packard Company makes no  -- representations about the suitability of this software for any  -- purpose.  It is provided "as is" without express or implied warranty.  --  --><Head><Title>bit_vector</Title><!-- Generated by htmldoc --></HEAD><BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 	ALINK="#ff0000"> <IMG SRC="CorpID.gif"      ALT="SGI" HEIGHT="43" WIDTH="151"> <!--end header--><BR Clear><H1>bit_vector</H1><Table CellPadding=0 CellSpacing=0 width=100%><TR><TD Align=left><Img src = "containers.gif" Alt=""   WIDTH = "194"  HEIGHT = "38" ></TD><TD Align=right><Img src = "type.gif" Alt=""   WIDTH = "194"  HEIGHT = "39" ></TD></TR><TR><TD Align=left VAlign=top><b>Category</b>: containers</TD><TD Align=right VAlign=top><b>Component type</b>: type</TD></TR></Table><h3>Description</h3>A <tt>bit_vector</tt> is essentially a<tt><A href="Vector.html">vector</A>&lt;bool&gt;</tt>: it is a<A href="Sequence.html">Sequence</A> that has the same interface as<tt><A href="Vector.html">vector</A></tt>.  The main difference isthat <tt>bit_vector</tt> is optimized for space efficiency.  A<tt>vector</tt> always requires at least one byte per element, but a<tt>bit_vector</tt> only requires one bit per element.<P><b>Warning</b>: The name <tt>bit_vector</tt> will be removed in a future releaseof the STL.  The only reason that <tt>bit_vector</tt> is a separate class,instead of a template specialization of <tt>vector&lt;bool&gt;</tt>, is that thiswould require partial specialization of templates.  On compilers thatsupport partial specialization, <tt>bit_vector</tt> is a specialization of<tt>vector&lt;bool&gt;</tt>.  The name <tt>bit_vector</tt> is a <tt>typedef</tt>.  This <tt>typedef</tt>is not defined in the C++ standard, and is retained only for backwardcompatibility.<h3>Example</h3><pre>bit_vector V(5);V[0] = true;V[1] = false;V[2] = false;V[3] = true;V[4] = false;for (bit_vector::iterator i = V.begin(); i &lt; V.end(); ++i)  cout &lt;&lt; (*i ? '1' : '0');cout &lt;&lt; endl;</pre><h3>Definition</h3>Defined in the standard header <A href="vector">vector</A>, and in the nonstandardbackward-compatibility header <A href="bvector.h">bvector.h</A>.<h3>Template parameters</h3>None. <tt>Bit_vector</tt> is not a class template.<h3>Model of</h3><A href="RandomAccessContainer.html">Random access container</A>,<A href="BackInsertionSequence.html">Back insertion sequence</A>.<h3>Type requirements</h3>None.<h3>Public base classes</h3>None.<h3>Members</h3><Table border><TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR><TR><TD VAlign=top><tt>value_type</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>The type of object stored in the bit_vector: <tt>bool</tt></TD></TR><TR><TD VAlign=top><tt>reference</tt></TD><TD VAlign=top><tt>bit_vector</tt></TD><TD VAlign=top>A proxy class that acts as a reference to a single bit.  See below   for details.</TD></TR><TR><TD VAlign=top><tt>const_reference</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Const reference to <tt>value_type</tt>.  In <tt>bit_vector</tt> this is simply defined   to be <tt>bool</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>An unsigned integral type.</TD></TR><TR><TD VAlign=top><tt>difference_type</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>A signed integral type.</TD></TR><TR><TD VAlign=top><tt>iterator</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Iterator used to iterate through a <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>const_iterator</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Const iterator used to iterate through a <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>reverse_iterator</tt></TD><TD VAlign=top> <A href="ReversibleContainer.html">Reversible Container</A></TD><TD VAlign=top>Iterator used to iterate backwards through a <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>const_reverse_iterator</tt></TD><TD VAlign=top> <A href="ReversibleContainer.html">Reversible Container</A></TD><TD VAlign=top>Const iterator used to iterate backwards through a <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>iterator begin()</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns an <tt>iterator</tt> pointing to the beginning of the <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>iterator end()</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns an <tt>iterator</tt> pointing to the end of the <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>const_iterator begin() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns a <tt>const_iterator</tt> pointing to the beginning of the <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>const_iterator end() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns a <tt>const_iterator</tt> pointing to the end of the <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>reverse_iterator rbegin()</tt></TD><TD VAlign=top> <A href="ReversibleContainer.html">Reversible Container</A></TD><TD VAlign=top>Returns a <tt>reverse_iterator</tt> pointing to the beginning of the   reversed bit_vector.</TD></TR><TR><TD VAlign=top><tt>reverse_iterator rend()</tt></TD><TD VAlign=top> <A href="ReversibleContainer.html">Reversible Container</A></TD><TD VAlign=top>Returns a <tt>reverse_iterator</tt> pointing to the end of the   reversed bit_vector.</TD></TR><TR><TD VAlign=top><tt>const_reverse_iterator rbegin() const</tt></TD><TD VAlign=top> <A href="ReversibleContainer.html">Reversible Container</A></TD><TD VAlign=top>Returns a <tt>const_reverse_iterator</tt> pointing to the beginning of the   reversed bit_vector.</TD></TR><TR><TD VAlign=top><tt>const_reverse_iterator rend() const</tt></TD><TD VAlign=top> <A href="ReversibleContainer.html">Reversible Container</A></TD><TD VAlign=top>Returns a <tt>const_reverse_iterator</tt> pointing to the end of the   reversed bit_vector.</TD></TR><TR><TD VAlign=top><tt>size_type size() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns the number of elements in the <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type max_size() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Returns the largest possible size of the <tt>bit_vector</tt>.</TD></TR><TR><TD VAlign=top><tt>size_type capacity() const</tt></TD><TD VAlign=top><tt>bit_vector</tt></TD><TD VAlign=top>See below.</TD></TR><TR><TD VAlign=top><tt>bool empty() const</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top><tt>true</tt> if the <tt>bit_vector</tt>'s size is <tt>0</tt>.</TD></TR><TR><TD VAlign=top><tt>reference operator[](size_type n)</tt></TD><TD VAlign=top> <A href="RandomAccessContainer.html">Random Access Container</A></TD><TD VAlign=top>Returns the <tt>n</tt>'th element.</TD></TR><TR><TD VAlign=top><tt>const_reference operator[](size_type n) const</tt></TD><TD VAlign=top> <A href="RandomAccessContainer.html">Random Access Container</A></TD><TD VAlign=top>Returns the <tt>n</tt>'th element.</TD></TR><TR><TD VAlign=top><tt>bit_vector()</tt></TD><TD VAlign=top> <A href="Container.html">Container</A></TD><TD VAlign=top>Creates an empty bit_vector.</TD></TR><TR><TD VAlign=top><tt>bit_vector(size_type n)</tt></TD><TD VAlign=top> <A href="Sequence.html">Sequence</A></TD><TD VAlign=top>Creates a bit_vector with <tt>n</tt> elements.</TD></TR><TR><TD VAlign=top><tt>bit_vector(size_type n, bool t)</tt></TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -