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

📄 boo_1544.htm

📁 ARM编辑、编译软件
💻 HTM
字号:
<HTML><HEAD><TITLE>Boolean Vectors</TITLE></HEAD>
<BODY>
<A HREF="ug.htm"><IMG SRC="images/banner.gif"></A>
<P><STRONG>Click on the banner to return to the user guide home page.</STRONG></P>
<P>&copy;Copyright 1996 Rogue Wave Software</P>
<H2>Boolean Vectors</H2>
<P>Vectors of bit values (boolean 1/0 values) are handled as a special case by the standard library, so that the values can be efficiently packed (several elements to a word).  The operations for a boolean vector , <B><I>vector&#60;bool></I></B>, are a superset of those for an ordinary vector, only the implementation is more efficient.</P>
<P>One new member function added to the boolean vector data type is <SAMP>flip().</SAMP>  When invoked, this function inverts all the bits of the vector.  Boolean vectors also return as reference an internal value that also supports the <SAMP>flip()</SAMP> member function.</P>
<PRE>   vector&#60;bool> bvec(27);
   bvec.flip();               // flip all values
   bvec[17].flip();           // flip bit 17</PRE>
<P><B><I>vector&#60;bool></I></B> also supports an additional <SAMP>swap()</SAMP> member function that allows you to swap the values indicated by a pair of references. </P>
<PRE>   bvec.swap(bvec [17], bvec [16]);</PRE>

<HR>
<A HREF="vec_8233.htm"><IMG SRC="images/prev.gif"></A> <A HREF="booktoc.htm"><IMG SRC="images/toc.gif"></A> <A HREF="exa_4427.htm"><IMG SRC="images/next.gif"></A></BODY></HTML>

⌨️ 快捷键说明

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