<legend id='LTVcO'><style id='LTVcO'><dir id='LTVcO'><q id='LTVcO'></q></dir></style></legend>

    <tfoot id='LTVcO'></tfoot>
    • <bdo id='LTVcO'></bdo><ul id='LTVcO'></ul>
  1. <small id='LTVcO'></small><noframes id='LTVcO'>

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

      在 GCC 4.x/C++11 中是否计算了 std::string 引用?

      时间:2023-09-19
      <i id='0Vijs'><tr id='0Vijs'><dt id='0Vijs'><q id='0Vijs'><span id='0Vijs'><b id='0Vijs'><form id='0Vijs'><ins id='0Vijs'></ins><ul id='0Vijs'></ul><sub id='0Vijs'></sub></form><legend id='0Vijs'></legend><bdo id='0Vijs'><pre id='0Vijs'><center id='0Vijs'></center></pre></bdo></b><th id='0Vijs'></th></span></q></dt></tr></i><div id='0Vijs'><tfoot id='0Vijs'></tfoot><dl id='0Vijs'><fieldset id='0Vijs'></fieldset></dl></div>
        <tbody id='0Vijs'></tbody>

          <bdo id='0Vijs'></bdo><ul id='0Vijs'></ul>
          • <small id='0Vijs'></small><noframes id='0Vijs'>

            1. <tfoot id='0Vijs'></tfoot>
              • <legend id='0Vijs'><style id='0Vijs'><dir id='0Vijs'><q id='0Vijs'></q></dir></style></legend>

              • 本文介绍了在 GCC 4.x/C++11 中是否计算了 std::string 引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                当使用带有 -std=c++0x-std=c++11 的 gcc 4 时 std::string 引用计数代码>?

                Is std::string reference-counted when using gcc 4 with -std=c++0x or -std=c++11?

                推荐答案

                看libstdc++ 文档 我发现(有关更多信息,请参阅链接):

                Looking at libstdc++ documentation I find (see the link for more info):

                一个字符串看起来像这样:

                A string looks like this:

                                       [_Rep]
                                       _M_length
                [basic_string<char>]   _M_capacity
                _M_dataplus            _M_refcount
                _M_p ----------------> unnamed array of char_type
                

                所以,是的,它是参考计数的.另外,来自这里的讨论:

                So, yes it is ref counted. Also, from the discussion here:

                是的,std::string 在某些时候会变成非引用计数,但是作为非引用计数的字符串在 C++98 中也是有效的,一个选项是切换到非引用计数的字符串-std=c++98 和 -std=c++11 模式.我不是说这就是会发生的事情,但它可能会发生.

                Yes, std::string will be made non-reference counting at some point, but as a non-reference-counted string is valid in C++98 as well, one option would be to switch to a non-ref-counted string for both -std=c++98 and -std=c++11 modes. I'm not saying that's what will happen, but it could be.

                所以,似乎有计划将其更改为符合标准(但我不知道进展如何).

                So, it seems there are plans to change it to be conforming (I don't know how the progress is going though).

                更新正如 emsr 在评论中指出的那样,目前有一个非引用计数扩展名为 vstring.h,这似乎是它没有取代 std::string 的唯一原因> 是因为 ABI 兼容性.此处有一个 SO 问题.

                Update As emsr points out in the comments, there is currently a non-reference counted extension called vstring.h, and it seems the only reason it hasn't replaced std::string is because of ABI compatibility. There is an SO question about it here.

                这篇关于在 GCC 4.x/C++11 中是否计算了 std::string 引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:gcc:未定义的引用 下一篇:如何使用 OpenSSL 的 SHA256 函数

                相关文章

                最新文章

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

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