Refactoring with C++ 11

前端 未结 11 2373
夕颜
夕颜 2020-11-28 18:17

Given the new toolset provided by c++ lots of programmers, aiming at code simplification, expressiveness, efficiency, skim through their old code and make tweaks (some point

11条回答
  •  执笔经年
    2020-11-28 18:43

    Feature: std::move

    "Express clear difference between the copying and moving the resources"

    std::string tmp("move");
    std::vector v;
    v.push_back(std::move(tmp));
    //At this point tmp still be the valid object but in unspecified state as
    // its resources has been moved and now stored in vector container.
    

提交回复
热议问题