<legend id='HNoiK'><style id='HNoiK'><dir id='HNoiK'><q id='HNoiK'></q></dir></style></legend>
  • <small id='HNoiK'></small><noframes id='HNoiK'>

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

        <tfoot id='HNoiK'></tfoot>
        • <bdo id='HNoiK'></bdo><ul id='HNoiK'></ul>

      1. C++ std::vector emplace 与插入

        时间:2023-09-15

          <bdo id='0hsJP'></bdo><ul id='0hsJP'></ul>

            <tbody id='0hsJP'></tbody>

          <small id='0hsJP'></small><noframes id='0hsJP'>

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

                • 本文介绍了C++ std::vector emplace 与插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想知道两者之间有什么区别.我注意到 emplace 是 c++11 加法.那么为什么要添加?

                  I was wondering what are the differences between the two. I notice that emplace is c++11 addition. So why the addition ?

                  推荐答案

                  Emplace 接受构建对象所需的参数,而 insert 接受(引用)一个对象.

                  Emplace takes the arguments necessary to construct an object in place, whereas insert takes (a reference to) an object.

                  struct Foo
                  {
                    Foo(int n, double x);
                  };
                  
                  std::vector<Foo> v;
                  v.emplace(someIterator, 42, 3.1416);
                  v.insert(someIterator, Foo(42, 3.1416));
                  

                  这篇关于C++ std::vector emplace 与插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:C++ 对象向量与指向对象的指针向量 下一篇:取消引用指向访问元素的向量指针

                  相关文章

                  最新文章

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

                  <tfoot id='r7FKg'></tfoot>

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

                        <bdo id='r7FKg'></bdo><ul id='r7FKg'></ul>