<tfoot id='kH0Ur'></tfoot>

      <small id='kH0Ur'></small><noframes id='kH0Ur'>

    1. <i id='kH0Ur'><tr id='kH0Ur'><dt id='kH0Ur'><q id='kH0Ur'><span id='kH0Ur'><b id='kH0Ur'><form id='kH0Ur'><ins id='kH0Ur'></ins><ul id='kH0Ur'></ul><sub id='kH0Ur'></sub></form><legend id='kH0Ur'></legend><bdo id='kH0Ur'><pre id='kH0Ur'><center id='kH0Ur'></center></pre></bdo></b><th id='kH0Ur'></th></span></q></dt></tr></i><div id='kH0Ur'><tfoot id='kH0Ur'></tfoot><dl id='kH0Ur'><fieldset id='kH0Ur'></fieldset></dl></div>

    2. <legend id='kH0Ur'><style id='kH0Ur'><dir id='kH0Ur'><q id='kH0Ur'></q></dir></style></legend>
        <bdo id='kH0Ur'></bdo><ul id='kH0Ur'></ul>

      1. 有没有办法在 C++ 源代码中用空格编写大量数字以使其更具可读性?

        Is there a way to write a large number in C++ source code with spaces to make it more readable?(有没有办法在 C++ 源代码中用空格编写大量数字以使其更具可读性?)

      2. <legend id='Kx12r'><style id='Kx12r'><dir id='Kx12r'><q id='Kx12r'></q></dir></style></legend>
        <i id='Kx12r'><tr id='Kx12r'><dt id='Kx12r'><q id='Kx12r'><span id='Kx12r'><b id='Kx12r'><form id='Kx12r'><ins id='Kx12r'></ins><ul id='Kx12r'></ul><sub id='Kx12r'></sub></form><legend id='Kx12r'></legend><bdo id='Kx12r'><pre id='Kx12r'><center id='Kx12r'></center></pre></bdo></b><th id='Kx12r'></th></span></q></dt></tr></i><div id='Kx12r'><tfoot id='Kx12r'></tfoot><dl id='Kx12r'><fieldset id='Kx12r'></fieldset></dl></div>

              • <bdo id='Kx12r'></bdo><ul id='Kx12r'></ul>
              • <tfoot id='Kx12r'></tfoot>
                  <tbody id='Kx12r'></tbody>

                1. <small id='Kx12r'></small><noframes id='Kx12r'>

                  本文介绍了有没有办法在 C++ 源代码中用空格编写大量数字以使其更具可读性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  假设我有代码:

                  vector<int> temp = vector<int>(1 000 000 000);
                  

                  以上不会编译,因为编译器会抱怨空格.是否可以指示 C++ 在编译时省略这些空格,或者以其他方式使数字更易于阅读?

                  The above will not compile as the compiler will complain about the spaces. Is it possible to indicate to C++ to ommit those spaces when compiling, or otherwise make the number easier to read?

                  推荐答案

                  试试数字分隔符:

                  int i = 1'000'000'000;
                  

                  此功能是 自 C++14 引入的.它使用单引号 (') 作为数字分隔符.

                  This feature is introduced since C++14. It uses single quote (') as digit separator.

                  另见:

                  • 为什么没有为 C++14 数字分隔符选择空格字符?
                  • 泛化 C++2000 的重载(C++ 之父 4 月的笑话)
                  • Why was the space character not chosen for C++14 digit separators?
                  • Generalizing Overloading for C++2000 (April's joke by the father of C++ himself)

                  这篇关于有没有办法在 C++ 源代码中用空格编写大量数字以使其更具可读性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)

                      <i id='6FrwR'><tr id='6FrwR'><dt id='6FrwR'><q id='6FrwR'><span id='6FrwR'><b id='6FrwR'><form id='6FrwR'><ins id='6FrwR'></ins><ul id='6FrwR'></ul><sub id='6FrwR'></sub></form><legend id='6FrwR'></legend><bdo id='6FrwR'><pre id='6FrwR'><center id='6FrwR'></center></pre></bdo></b><th id='6FrwR'></th></span></q></dt></tr></i><div id='6FrwR'><tfoot id='6FrwR'></tfoot><dl id='6FrwR'><fieldset id='6FrwR'></fieldset></dl></div>
                        <tbody id='6FrwR'></tbody>
                          <legend id='6FrwR'><style id='6FrwR'><dir id='6FrwR'><q id='6FrwR'></q></dir></style></legend>

                        • <tfoot id='6FrwR'></tfoot>
                            <bdo id='6FrwR'></bdo><ul id='6FrwR'></ul>

                          • <small id='6FrwR'></small><noframes id='6FrwR'>