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

    你可能感兴趣的文章
    nodejs封装http请求
    查看>>
    nodejs常用组件
    查看>>
    nodejs开发公众号报错 40164,白名单配置找不到,竟然是这个原因
    查看>>
    Nodejs异步回调的处理方法总结
    查看>>
    NodeJS报错 Fatal error: ENOSPC: System limit for number of file watchers reached, watch ‘...path...‘
    查看>>
    nodejs支持ssi实现include shtml页面
    查看>>
    Nodejs教程09:实现一个带接口请求的简单服务器
    查看>>
    nodejs服务端实现post请求
    查看>>
    nodejs框架,原理,组件,核心,跟npm和vue的关系
    查看>>
    Nodejs概览: 思维导图、核心技术、应用场景
    查看>>
    nodejs模块——fs模块
    查看>>
    Nodejs模块、自定义模块、CommonJs的概念和使用
    查看>>
    nodejs生成多层目录和生成文件的通用方法
    查看>>
    nodejs端口被占用原因及解决方案
    查看>>
    Nodejs简介以及Windows上安装Nodejs
    查看>>
    nodejs系列之express
    查看>>
    nodejs系列之Koa2
    查看>>
    Nodejs连接mysql
    查看>>
    nodejs连接mysql
    查看>>
    NodeJs连接Oracle数据库
    查看>>