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

📄 bitset_constructors.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>  <meta name="generator" content=  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">  <title>Bitset Constructors</title>  <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table>  <tr>  <td>  <div class="body-content">  <div class="header-box">    <a href="../index.html">cppreference.com</a> &gt; <a href=    "index.html">C++ Bitsets</a> &gt; <a href=    "bitset_constructors.html">Bitset Constructors</a>  </div>  <div class="name-format">    Bitset Constructors  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;bitset&gt;  bitset();  bitset( unsigned long val );</pre>  <p>Bitsets can either be constructed with no arguments or with an  unsigned long number val that will be converted into binary and  inserted into the bitset. When creating bitsets, the number given in  the place of the template determines how long the bitset is.</p>  <p>For example, the following code creates two bitsets and displays  them:</p>  <pre class="example-code"> // create a bitset that is 8 bits long bitset&lt;8&gt; bs; // display that bitset for( int i = (int) bs.size()-1; i &gt;= 0; i-- ) {   cout &lt;&lt; bs[i] &lt;&lt; &quot; &quot;; } cout &lt;&lt; endl; // create a bitset out of a number bitset&lt;8&gt; bs2( (long) 131 ); // display that bitset, too for( int i = (int) bs2.size()-1; i &gt;= 0; i-- ) {   cout &lt;&lt; bs2[i] &lt;&lt; &quot; &quot;; } cout &lt;&lt; endl;            </pre>  </div>  </td>    </tr>  </table></body></html>

⌨️ 快捷键说明

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