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

    你可能感兴趣的文章
    Nginx log文件写入失败?log文件权限设置问题
    查看>>
    Nginx Lua install
    查看>>
    nginx net::ERR_ABORTED 403 (Forbidden)
    查看>>
    Nginx SSL私有证书自签,且反代80端口
    查看>>
    Nginx upstream性能优化
    查看>>
    Nginx 中解决跨域问题
    查看>>
    nginx 代理解决跨域
    查看>>
    Nginx 动静分离与负载均衡的实现
    查看>>
    Nginx 反向代理 MinIO 及 ruoyi-vue-pro 配置 MinIO 详解
    查看>>
    nginx 反向代理 转发请求时,有时好有时没反应,产生原因及解决
    查看>>
    Nginx 反向代理解决跨域问题
    查看>>
    Nginx 反向代理配置去除前缀
    查看>>
    nginx 后端获取真实ip
    查看>>
    Nginx 多端口配置和访问异常问题的排查与优化
    查看>>
    Nginx 如何代理转发传递真实 ip 地址?
    查看>>
    Nginx 学习总结(16)—— 动静分离、压缩、缓存、黑白名单、性能等内容温习
    查看>>
    Nginx 学习总结(17)—— 8 个免费开源 Nginx 管理系统,轻松管理 Nginx 站点配置
    查看>>
    Nginx 学习(一):Nginx 下载和启动
    查看>>
    nginx 常用指令配置总结
    查看>>
    Nginx 常用配置清单
    查看>>