首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏fangyangcoder

    copy-and-swap idiom

    While the goals and implementation of the copy-constructor and destructor are straightforward, the copy-assignment Conceptually, it works by using the copy-constructor's functionality to create a local copy of the data In order to use the copy-and-swap idiom, we need three things: a working copy-constructor, a working We start with a working constructor, copy-constructor, and destructor: #include <algorithm> // std::copy new int[mSize]() : nullptr) { } // copy-constructor dumb_array(const dumb_array& other

    1.1K20发布于 2019-12-12
  • 来自专栏ClearSeve

    copy-and-swap 是什么

    new int[mSize]() : nullptr) { } // copy-constructor dumb_array(const dumb_array& other

    1.1K20编辑于 2022-02-10
  • 来自专栏光城(guangcity)

    (大boss)C++惯用法之copy-swap

    std :: swap在实现中使用了copy-constructor和copy-assignment运算符,我们最终将尝试根据自身定义赋值运算符!

    1.8K20发布于 2019-12-29
  • 来自专栏Albert陈凯

    2019-04-30 自从用了Gitbook 简书用的都少了,来个水贴 MimeType OR MediaType

    Collections.singletonMap(PARAM_QUALITY_FACTOR, Double.toString(qualityValue))); } /** * Copy-constructor MediaType(MediaType other, Charset charset) { super(other, charset); } /** * Copy-constructor

    1.2K30发布于 2019-05-14
  • 来自专栏高性能服务器开发

    API设计原则 – QT官网的设计实践总结

    如果类型有重型的(non-trivial)拷贝构造函数(copy-constructor)或是重型的析构函数(destructor),按常量引用传参以避免执行这些函数。 setCategory(QChar cat); 3void setName(QLatin1String name); 4 5// const-ref is much faster than running copy-constructor

    3.1K20发布于 2018-08-17
  • 来自专栏用户2442861的专栏

    C++编程思想重点笔记

    f(n); // error: copy-constructor called

  • <li class="L2" style="padding-left:

1K10发布于 2018-09-20
领券