博客
关于我
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/

    你可能感兴趣的文章
    NFS共享文件系统搭建
    查看>>
    nfs复习
    查看>>
    NFS安装配置
    查看>>
    NFS的安装以及windows/linux挂载linux网络文件系统NFS
    查看>>
    NFS的常用挂载参数
    查看>>
    NFS网络文件系统
    查看>>
    nft文件传输_利用remoting实现文件传输-.NET教程,远程及网络应用
    查看>>
    NFV商用可行新华三vBRAS方案实践验证
    查看>>
    ng build --aot --prod生成文件报错
    查看>>
    ng 指令的自定义、使用
    查看>>
    nghttp3使用指南
    查看>>
    Nginx
    查看>>
    nginx + etcd 动态负载均衡实践(三)—— 基于nginx-upsync-module实现
    查看>>
    nginx + etcd 动态负载均衡实践(二)—— 组件安装
    查看>>
    nginx + etcd 动态负载均衡实践(四)—— 基于confd实现
    查看>>
    Nginx + Spring Boot 实现负载均衡
    查看>>
    Nginx + uWSGI + Flask + Vhost
    查看>>
    Nginx - Header详解
    查看>>
    Nginx - 反向代理、负载均衡、动静分离、底层原理(案例实战分析)
    查看>>
    nginx 1.24.0 安装nginx最新稳定版
    查看>>