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

📄 bitset.html

📁 ST20 Embedded Toolset R2.0.5用于开发基于ST20芯片机顶盒软件的开发平台,2.0.5版本,国内找不到的.在国外论坛上花了N天才找到!
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML><HEAD><TITLE>&lt;bitset&gt;</TITLE></HEAD><BODY><H1><A NAME="&lt;bitset&gt;"><CODE>&lt;bitset&gt;</CODE></A></H1><HR><P><B><CODE><A HREF="#bitset">bitset</A>&#183; <A HREF="#operator&amp;">operator&amp;</A>&#183; <A HREF="#operator|">operator|</A>&#183; <A HREF="#operator^">operator^</A>&#183; <A HREF="#operator&gt;&gt;">operator&gt;&gt;</A>&#183; <A HREF="#operator&lt;&lt;">operator&lt;&lt;</A></CODE></B></P><P>Include the standard header <B><CODE>&lt;bitset&gt;</CODE></B>to define the template class <CODE>bitset</CODE>and two supporting templates.</P><PRE>namespace std {template&lt;size_t Bits&gt;    class <B><A HREF="#bitset">bitset</A></B>;        // TEMPLATE FUNCTIONStemplate&lt;size_t Bits&gt;    bitset&lt;Bits&gt;        <B><A HREF="#operator&amp;">operator&amp;</A></B>(const bitset&amp; left,            const bitset&amp; right);template&lt;size_t Bits&gt;    bitset&lt;Bits&gt;        <B><A HREF="#operator|">operator|</A></B>(const bitset&amp; left,            const bitset&amp; right);template&lt;size_t Bits&gt;    bitset&lt;Bits&gt;        <B><A HREF="#operator^">operator&</A></B>(const bitset&amp; left,            const bitset&amp; right);template&lt;class Elem, class Tr, size_t Bits&gt;    basic_istream&lt;Elem, Tr&gt;&amp;        <B><A HREF="#operator&gt;&gt;">operator&gt;&gt;</A></B>(basic_istream&lt;Elem, &gt;&amp; istr,            bitset&lt;Bits&gt;&amp; right);template&lt;class Elem, class Tr, size_t Bits&gt;    basic_ostream&lt;Elem, Tr&gt;&amp;        <B><A HREF="#operator&lt;&lt;">operator&lt;&lt;</A></B>(basic_ostream&lt;Elem, Tr&gt;&amp; ostr,            const bitset&lt;Bits&gt;&amp; right);    };</PRE><H2><A NAME="bitset"><CODE>bitset</CODE></A></H2><HR><P><B><CODE><A HREF="#bitset::any">any</A>&#183; <A HREF="#bitset::bitset">bitset</A>&#183; <A HREF="#bitset::count">count</A>&#183; <A HREF="#bitset::element_type">element_type</A>&#183; <A HREF="#bitset::flip">flip</A>&#183; <A HREF="#bitset::none">none</A>&#183; <A HREF="#bitset::operator!=">operator!=</A>&#183; <A HREF="#bitset::operator&amp;=">operator&amp;=</A>&#183; <A HREF="#bitset::operator&lt;&lt;">operator&lt;&lt;</A>&#183; <A HREF="#bitset::operator&lt;&lt;=">operator&lt;&lt;=</A>&#183; <A HREF="#bitset::operator==">operator==</A>&#183; <A HREF="#bitset::operator&gt;&gt;">operator&gt;&gt;</A>&#183; <A HREF="#bitset::operator&gt;&gt;=">operator&gt;&gt;=</A>&#183; <A HREF="#bitset::operator[]">operator[]</A>&#183; <A HREF="#bitset::operator^=">operator^=</A>&#183; <A HREF="#bitset::operator|=">operator|=</A>&#183; <A HREF="#bitset::operator~">operator~</A>&#183; <A HREF="#bitset::reference">reference</A>&#183; <A HREF="#bitset::reset">reset</A>&#183; <A HREF="#bitset::set">set</A>&#183; <A HREF="#bitset::size">size</A>&#183; <A HREF="#bitset::test">test</A>&#183; <A HREF="#bitset::to_string">to_string</A>&#183; <A HREF="#bitset::to_ulong">to_ulong</A></CODE></B></P><HR><PRE>template&lt;size_t Bits&gt;    class <B>bitset</B> {public:    typedef bool <B><A HREF="#bitset::element_type">element_type</A></B>;    class <B><A HREF="#bitset::reference">reference</A></B>;    <B><A HREF="#bitset::bitset">bitset</A></B>();    <B><A HREF="#bitset::bitset">bitset</A></B>(unsigned long val);    template&lt;class Elem, class Tr, class Alloc&gt;        explicit <B><A HREF="#bitset::bitset">bitset</A></B>(const basic_string&lt;Elem, Tr, Alloc&gt;&amp; str,            typename basic_string&lt;Elem, Tr, Alloc&gt;::size_type                pos = 0,            typename basic_string&lt;Elem, Tr, Alloc&gt;::size_type                count = basic_string&lt;Elem, Tr, Alloc&gt;::npos);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::operator&amp;=">operator&amp;=</A></B>(const bitset&lt;Bits&gt;&amp; right);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::operator|=">operator|=</A></B>(const bitset&lt;Bits&gt;&amp; right);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::operator^=">operator^=</A></B>(const bitset&lt;Bits&gt;&amp; right);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::operator&lt;&lt;=">operator&lt;&lt;=</A></B>(const bitset&lt;Bits&gt;&amp; pos);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::operator&gt;&gt;=">operator&gt;&gt;=</A></B>(const bitset&lt;Bits&gt;&amp; pos);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::set">set</A></B>();    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::set">set</A></B>(size_t pos, bool val = true);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::reset">reset</A></B>();    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::reset">reset</A></B>(size_t pos);    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::flip">flip</A></B>();    bitset&lt;Bits&gt;&amp; <B><A HREF="#bitset::flip">flip</A></B>(size_t pos);    reference <B><A HREF="#bitset::operator[]">operator[]</A></B>(size_t pos);    bool <B><A HREF="#bitset::operator[]">operator[]</A></B>(size_t pos) const;    unsigned long <B><A HREF="#bitset::to_ulong">to_ulong</A></B>() const;    template&lt;class Elem, class Tr, class Alloc&gt;        basic_string&lt;Elem, Tr, Alloc&gt; <B><A HREF="#bitset::to_string">to_string</A></B>() const;    size_t <B><A HREF="#bitset::count">count</A></B>() const;    size_t <B><A HREF="#bitset::size">size</A></B>() const;    bool <B><A HREF="#bitset::operator==">operator==</A></B>(const bitset&lt;Bits&gt;&amp; right) const;    bool <B><A HREF="#bitset::operator!=">operator!=</A></B>(const bitset&lt;Bits&gt;&amp; right) const;    bool <B><A HREF="#bitset::test">test</A></B>(size_t pos) const;    bool <B><A HREF="#bitset::any">any</A></B>() const;    bool <B><A HREF="#bitset::none">none</A></B>() const;    bitset&lt;Bits&gt; <B><A HREF="#bitset::operator&lt;&lt;">operator&lt;&lt;</A></B>(size_t pos) const;    bitset&lt;Bits&gt; <B><A HREF="#bitset::operator&gt;&gt;">operator&gt;&gt;</A></B>(size_t pos) const;    bitset&lt;Bits&gt; <B><A HREF="#bitset::operator~">operator~</A></B>() const;    };</PRE><P>The template class describes an object that stores asequence of <CODE>Bits</CODE> bits. A bit is<B><A NAME="bit set">set</A></B> if its value is 1,<B><A NAME="bit reset">reset</A></B> if its value is 0.To <B><A NAME="bit flip">flip</A></B> a bit is to change its valuefrom 1 to 0 or from 0 to 1.When converting between an object ofclass <CODE>bitset&lt;Bits&gt;</CODE> and an object of some integral type,bit position <CODE>J</CODE> corresponds to the bit value<CODE>1 &lt;&lt; J</CODE>. The integral value corresponding to twoor more bits is the sum of their bit values.</P><H3><CODE><A NAME="bitset::any">bitset::any</A></CODE></H3><PRE>bool <B>any</B>() const;</PRE><P>The member function returns true if any bit is set in thebit sequence.</P><H3><CODE><A NAME="bitset::bitset">bitset::bitset</A></CODE></H3><PRE><B>bitset</B>();<B>bitset</B>(unsigned long val);template&lt;class Elem, class Tr, class Alloc&gt;    explicit <B>bitset</B>(const basic_string&lt;Elem, Tr, Alloc&gt;&amp; str,        typename basic_string&lt;Elem, Tr, Alloc&gt;::size_type            pos = 0,        typename basic_string&lt;Elem, Tr, Alloc&gt;::size_type            count = basic_string&lt;Elem, Tr, Alloc&gt;::npos);</PRE><P>The first constructor resets all bits in the bit sequence.The second constructor sets only those bits at position <CODE>J</CODE>for which <CODE>val &amp; 1 &lt;&lt; J</CODE> is nonzero.</P><P>The third constructor determines the initial bit values fromelements of a string determined from <CODE>str</CODE>. If<CODE>str.<A HREF="string2.html#basic_string::size">size</A>()&lt; pos</CODE>, the constructor throws an object of class<CODE><A HREF="stdexcep.html#out_of_range">out_of_range</A></CODE>.Otherwise, the effective length of the string <CODE>rlen</CODE>is the smaller of <CODE>count</CODE> and<CODE>str.size() - pos</CODE>. If any of the <CODE>rlen</CODE>elements beginning at position <CODE>pos</CODE> is other than<CODE>0</CODE> or <CODE>1</CODE>, the constructor throws an object of class<CODE><A HREF="stdexcep.html#invalid_argument">invalid_argument</A></CODE>.Otherwise, the constructor sets only those bits at position <CODE>J</CODE>for which the element at position <CODE>pos + J</CODE> is <CODE>1</CODE>.</P><H3><CODE><A NAME="bitset::count">bitset::count</A></CODE></H3><PRE>size_t <B><A HREF="#bitset::count">count</A></B>() const;</PRE><P>The member function returns the number of bits set in thebit sequence.</P><H3><CODE><A NAME="bitset::element_type">bitset::element_type</A></CODE></H3><PRE>typedef bool <B>element_type</B>;</PRE><P>The type is a synonym for <CODE>bool</CODE>.</P><H3><CODE><A NAME="bitset::flip">bitset::flip</A></CODE></H3><PRE>bitset&lt;Bits&gt;&amp; <B>flip</B>();bitset&lt;Bits&gt;&amp; <B>flip</B>(size_t pos);</PRE><P>The first member function flips all bits in the bit sequence,then returns <CODE>*this</CODE>.The second member function throws<CODE><A HREF="stdexcep.html#out_of_range">out_of_range</A></CODE> if<CODE><A HREF="#bitset::size">size</A>()&lt;= pos</CODE>. Otherwise, it flips the bitat position <CODE>pos</CODE>, then returns <CODE>*this</CODE>.</P><H3><CODE><A NAME="bitset::none">bitset::none</A></CODE></H3><PRE>bool <B><A HREF="#bitset::none">none</A></B>() const;</PRE><P>The member function returns true if none of the bits are setin the bit sequence.</P><H3><CODE><A NAME="bitset::operator!=">bitset::operator!=</A></CODE></H3><PRE>bool <B>operator !=</B>(const bitset&lt;Bits&gt;&amp; right) const;</PRE><P>The member operator function returns trueonly if the bit sequence stored in<CODE>*this</CODE> differs from the one stored in <CODE>right</CODE>.</P><H3><CODE><A NAME="bitset::operator&amp;=">bitset::operator&amp;=</A></CODE></H3><PRE>bitset&lt;Bits&gt;&amp; <B>operator&amp;=</B>(const bitset&lt;Bits&gt;&amp; right);</PRE><P>The member operator function replaces each element of the bit sequence storedin <CODE>*this</CODE> with the logical AND of its previous value andthe corresponding bit in <CODE>right</CODE>.The function returns <CODE>*this</CODE>.</P><H3><CODE><A NAME="bitset::operator&lt;&lt;">bitset::operator&lt;&lt;</A></CODE></H3><PRE>bitset&lt;Bits&gt; <B>operator&lt;&lt;</B>(const bitset&lt;Bits&gt;&amp; pos);</PRE><P>The member operator function returns <CODE>bitset(*this)<A HREF="#bitset::operator&lt;&lt;=">&lt;&lt;=</A> pos</CODE>.</P><H3><CODE><A NAME="bitset::operator&lt;&lt;=">bitset::operator&lt;&lt;=</A></CODE></H3><PRE>bitset&lt;Bits&gt;&amp; <B>operator&lt;&lt;=</B>(const bitset&lt;Bits&gt;&amp; pos);</PRE><P>The member operator function replaceseach element of the bit sequence storedin <CODE>*this</CODE> with the element <CODE>pos</CODE> positions earlierin the sequence. If no such earlier element exists, the function clearsthe bit. The function returns <CODE>*this</CODE>.</P><H3><CODE><A NAME="bitset::operator==">bitset::operator==</A></CODE></H3><PRE>bool <B>operator ==</B>(const bitset&lt;Bits&gt;&amp; right) const;</PRE><P>The member operator function returns trueonly if the bit sequence stored in<CODE>*this</CODE> is the same as the one stored in <CODE>right</CODE>.</P><H3><CODE><A NAME="bitset::operator&gt;&gt;">bitset::operator&gt;&gt;</A></CODE></H3>

⌨️ 快捷键说明

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