博客
关于我
C++ Primer 5th笔记(chap 13 拷贝控制) 对象移动
阅读量:83 次
发布时间:2019-02-26

本文共 1547 字,大约阅读时间需要 5 分钟。

C++???????????????

?????????

???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????IO??unique_ptr???????????????????????????????????????????????????????????????????????????????????????????????????????

????????

??????

?C++????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

?????????????????????????int i = 42;??i???????????????????????????

????

?????C++???????????????????????????????????????????????????

???????????????

  • ???????????????????????????????????
  • ????????????????????????????
  • ?????????????????????????????????????
  • ??????????????????????????
  • ?????move??

    ??????????C++??????std::move???????????????????????????????

    int rr3 = std::move(rr1); // ??

    ??????????

    ?C++?????????????????????????????????????????????????????????????

    ????StrVec?push_back??????????

    void StrVec::push_back(const std::string& s) {    // ????}void StrVec::push_back(std::string&& s) {    // ????}

    ????

    ???StrVec??push_back??????????

    inline void StrVec::push_back(const std::string& s) {    chk_n_alloc(); // ???????    alloc.construct(first_free++, s); // ????}inline void StrVec::push_back(std::string&& s) {    chk_n_alloc(); // ???????    alloc.construct(first_free++, std::move(s)); // ????}

    ???????

    StrVec vec;std::string s = "some string or another";vec.push_back(s); // ??`push_back(const std::string&)`vec.push_back("done"); // ??`push_back(std::string&&)`

    ?????????????????????????????????????????????

    转载地址:http://gbdz.baihongyu.com/

    你可能感兴趣的文章
    numpy判断对应位置是否相等,all、any的使用
    查看>>
    Numpy多项式.Polynomial.fit()给出的系数与多项式.Polyfit()不同
    查看>>
    Numpy如何使用np.umprod重写range函数中i的python
    查看>>
    numpy学习笔记3-array切片
    查看>>
    numpy数组替换其中的值(如1替换为255)
    查看>>
    numpy数组索引-ChatGPT4o作答
    查看>>
    numpy最大值和最大值索引
    查看>>
    NUMPY矢量化np.prod不能构造具有超过32个操作数的ufunc
    查看>>
    Numpy矩阵与通用函数
    查看>>
    numpy绘制热力图
    查看>>
    numpy转PIL 报错TypeError: Cannot handle this data type
    查看>>
    Numpy闯关100题,我闯了95关,你呢?
    查看>>
    nump模块
    查看>>
    Nutch + solr 这个配合不错哦
    查看>>
    NuttX 构建系统
    查看>>
    NutUI:京东风格的轻量级 Vue 组件库
    查看>>