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

📄 bit_vector.html

📁 VC书籍介绍C++的应用的TheOODesignProcess.zip 电子书好用的
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</TR>
<TR>
<TD VAlign=top>
<pre>
template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;
bit_vector(InputIterator, InputIterator)
<A href="#1">[1]</A>
</pre>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Creates a bit_vector with a copy of a range.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>~bit_vector()</tt>
</TD>
<TD VAlign=top>
 <A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
The destructor.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>bit_vector&amp; operator=(const bit_vector&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
The assignment operator
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void reserve(size_t)</tt>
</TD>
<TD VAlign=top>
<tt>bit_vector</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reference front()</tt>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Returns the first element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>const_reference front() const</tt>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Returns the first element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>reference back()</tt>
</TD>
<TD VAlign=top>
 <A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Returns the last element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>const_reference back() const</tt>
</TD>
<TD VAlign=top>
 <A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Returns the last element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void push_back(const T&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Inserts a new element at the end.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void pop_back()</tt>
</TD>
<TD VAlign=top>
 <A href="BackInsertionSequence.html">Back Insertion Sequence</A>
</TD>
<TD VAlign=top>
Removes the last element.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void swap(bit_vector&amp;)</tt>
</TD>
<TD VAlign=top>
 <A href="Container.html">Container</A>
</TD>
<TD VAlign=top>
Swaps the contents of two bit_vectors.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
void swap(bit_vector::reference x,
          bit_vector::reference y)
</pre>
</TD>
<TD VAlign=top>
<tt>bit_vector</tt>
</TD>
<TD VAlign=top>
See below.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>iterator insert(iterator pos, bool x)</tt>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Inserts <tt>x</tt> before <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
template &lt;class <A href="InputIterator.html">InputIterator</A>&gt;
void insert(iterator pos,
            InputIterator f, InputIterator l)
<A href="#1">[1]</A>
</pre>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Inserts the range <tt>[f, l)</tt> before <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
void insert(iterator pos, 
            size_type n, bool x)
</pre>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Inserts <tt>n</tt> copies of <tt>x</tt> before <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void erase(iterator pos)</tt>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases the element at position <tt>pos</tt>.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void erase(iterator first, iterator last)</tt>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases the range <tt>[first, last)</tt>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void clear()</tt>
</TD>
<TD VAlign=top>
 <A href="Sequence.html">Sequence</A>
</TD>
<TD VAlign=top>
Erases all of the elements.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
bool operator==(const bit_vector&amp;, 
                const bit_vector&amp;)
</pre>
</TD>
<TD VAlign=top>
 <A href="ForwardContainer.html">Forward Container</A>
</TD>
<TD VAlign=top>
Tests two bit_vectors for equality.  This is a global function, not
   a member function.
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
bool operator&lt;(const bit_vector&amp;, 
               const bit_vector&amp;)
</pre>
</TD>
<TD VAlign=top>
 <A href="ForwardContainer.html">Forward Container</A>
</TD>
<TD VAlign=top>
Lexicographical comparison.  This is a global function, not
   a member function.
</TD>
</tr>
</table>
<h3>New members</h3>
These members are not defined in the 
<A href="RandomAccessContainer.html">Random access container</A> 
and <A href="BackInsertionSequence.html">Back insertion sequence</A>
requirements, but are specific to <tt>vector</tt>.
<Table border>
<TR>
<TH>
Member
</TH>
<TH>
Description
</TH>
</TR>
<TR>
<TD VAlign=top>
<tt>reference</tt>
</TD>
<TD VAlign=top>
A proxy class that acts as a reference to a single bit; the reason it
   exists is to allow expressions like <tt>V[0] = true</tt>.  (A proxy
   class like this is necessary, because the C++ memory model does not
   include independent addressing of objects smaller than one byte.)
   The public member functions of <tt>reference</tt> are <tt>operator bool() const</tt>,
   <tt>reference&amp; operator=(bool)</tt>, and <tt>void flip()</tt>.  That is, <tt>reference</tt>
   acts like an ordinary reference: you can convert a <tt>reference</tt> to <tt>bool</tt>, 
   assign a <tt>bool</tt> value through a <tt>reference</tt>, or flip the bit that a
   <tt>reference</tt> refers to.
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>size_type capacity() const</tt>
</TD>
<TD VAlign=top>
Number of bits for which memory has been allocated.
   <tt>capacity()</tt> is always greater than or equal to <tt>size()</tt>.
   <A href="#2">[2]</A> <A href="#3">[3]</A>
</TD>
</TR>
<TR>
<TD VAlign=top>
<tt>void reserve(size_type n)</tt>
</TD>
<TD VAlign=top>
If <tt>n</tt> is less than or equal to <tt>capacity()</tt>, this call has no effect.
    Otherwise, it is a request for the allocation of additional 
    memory.  If the request is successful, then <tt>capacity()</tt> is
    greater than or equal to <tt>n</tt>; otherwise, <tt>capacity()</tt> is unchanged.
    In either case, <tt>size()</tt> is unchanged.  <A href="#2">[2]</A> <A href="#4">[4]</A>
</TD>
</TR>
<TR>
<TD VAlign=top>
<pre>
void swap(bit_vector::reference x,
          bit_vector::reference y)
</pre>
</TD>
<TD VAlign=top>
Swaps the bits referred to by <tt>x</tt> and <tt>y</tt>.  This is a global function,
   not a member function.  It is necessary because the ordinary version
   of <tt><A href="swap.html">swap</A></tt> takes arguments of type <tt>T&amp;</tt>, and <tt>bit_vector::reference</tt>
   is a class, not a built-in C++ reference.
</TD>
</tr>
</table>
<h3>Notes</h3>
<P><A name="1">[1]</A>
This member function relies on <i>member template</i> functions, which
at present (early 1998) are not supported by all compilers.  If your
compiler supports member templates, you can call this function with
any type of <A href="InputIterator.html">input iterator</A>.  If your
compiler does not yet support member templates, though, then the
arguments must either be of type <tt>const bool*</tt> or of type
<tt>bit_vector::const_iterator</tt>.
<P><A name="2">[2]</A>
Memory will be reallocated automatically if more than <tt>capacity() -
size()</tt> bits are inserted into the bit_vector.  Reallocation does
not change <tt>size()</tt>, nor does it change the values of any bits
of the bit_vector.  It does, however, increase <tt>capacity()</tt>,
and it invalidates <A href="#5">[5]</A> any iterators that point into
the bit_vector.
<P><A name="3">[3]</A>
When it is necessary to increase <tt>capacity()</tt>,
<tt>bit_vector</tt> usually increases it by a factor of two.  It is
crucial that the amount of growth is proportional to the current
<tt>capacity()</tt>, rather than a fixed constant: in the former case
inserting a series of bits into a bit_vector is a linear time
operation, and in the latter case it is quadratic.
<P><A name="4">[4]</A>
<tt>reserve()</tt> is used to cause a reallocation manually.  The main
reason for using <tt>reserve()</tt> is efficiency: if you know the
capacity to which your <tt>bit_vector</tt> must eventually grow, then
it is probably more efficient to allocate that memory all at once
rather than relying on the automatic reallocation scheme.  The other
reason for using <tt>reserve()</tt> is to control the invalidation of
iterators. <A href="#5">[5]</A>
<P><A name="5">[5]</A>
A <tt>bit_vector</tt>'s iterators are invalidated when its memory is
reallocated.  Additionally, inserting or deleting a bit in the middle
of a bit_vector invalidates all iterators that point to bits following
the insertion or deletion point.  It follows that you can prevent a
bit_vector's iterators from being invalidated if you use
<tt>reserve()</tt> to preallocate as much storage as the bit_vector
will ever use, and if all insertions and deletions are at the
bit_vector's end.
<h3>See also</h3>
<A href="Vector.html">vector</A>

<HR SIZE="6"> <FONT SIZE="-2"> Copyright &copy; 1996 Silicon Graphics, Inc.
<HR>
<TABLE BORDER=0 WIDTH="100%" >
<TR>
<TD WIDTH="33%"><FONT SIZE=-1><A HREF="index.html" >
STL</A></FONT></TD>

<TD WIDTH="33%">
<CENTER><FONT SIZE=-2>&copy; Copyright 1997-1998 CodeGuru</FONT>&nbsp;</CENTER>
</TD>

<TD WIDTH="34%">
<DIV ALIGN=right><FONT SIZE=-1>Contact : <A HREF="mailto:webmaster@codeguru.com">webmaster@codeguru.com</A>&nbsp;</FONT></DIV>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="JavaScript" ><!--
var adurl = "/cgi-bin/doubleclick.cgi?";

if( self.adcategory )
	adurl += adcategory;
else
	adurl += "mfc";

if( self.parent.norefreshad )
	parent.norefreshad = false;
else if( validframes )
	parent.frames['ad'].location = adurl;



if( !validframes && nfrm == -1)
{
	var dclkPage = "www.codeguru.com/";
	if( self.adcategory )
		dclkPage += adcategory;
	else 
		dclkPage += "mfc";
//	var random = Math.random();
	document.write('<nolayer><center>');
	document.write('<iframe src="http://ad.doubleclick.net/adi/' + dclkPage + ';ord='
	 + random + '" width=470 height=62 marginwidth=0 marginheight=0 hspace=0 vspace=0 '
	 + 'frameborder=0 scrolling=no bordercolor="#000000">');
	document.write('<a href="http://ad.doubleclick.net/jump/' + dclkPage + ';ord='
	 + random + '">');
	document.write('<img src="http://ad.doubleclick.net/ad/' + dclkPage + ';ord='
	 + random + '" height=60 width=468>' + '</a>');
	document.write('</iframe>');
	document.write('</center></nolayer>');
	document.write('<layer  src="http://ad.doubleclick.net/adl/' + dclkPage + 
	 ';ord=' + random + '"></layer>');
	document.write('<ilayer visibility=hide width=468 height=83></ilayer>');
}

// -->
</SCRIPT> 
<!-- SCRIPT LANGUAGE="JavaScript" SRC="/global/fscript.js">
//
</SCRIPT --> 

<noscript>
<p align="center">
<a href="http://ad.doubleclick.net/jump/www.codeguru.com/cpp;ord=NupaQNFCY34AAHKMEVY">
<img src="http://ad.doubleclick.net/ad/www.codeguru.com/cpp;ord=NupaQNFCY34AAHKMEVY"></a>
</p>
</noscript>





</BODY>
</HTML>


⌨️ 快捷键说明

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