move

作者: 孤影渐苍茫 | 来源:发表于2019-11-24 12:47 被阅读0次

举例

// move example
#include <utility>      // std::move
#include <iostream>     // std::cout
#include <vector>       // std::vector
#include <string>       // std::string

int main () {
  std::string foo = "foo-string";
  std::string bar = "bar-string";
  std::vector<std::string> myvector;

  myvector.push_back (foo);                    // copies
  myvector.push_back (std::move(bar));         // moves

  std::cout << "myvector contains:";
  for (std::string& x:myvector) std::cout << ' ' << x;
  std::cout << '\n';

  std::cout << "foo:" << foo << '\n';
  
  std::cout << "bar:" << bar << '\n';

  return 0;
}
myvector contains: foo-string bar-string
foo:foo-string
bar:

相关文章

  • 【move】2.Move Tutorial

    Move 教程(Move Tutorial) Welcome to the Move Tutorial! In t...

  • 47/100

    move on move on! night–night(´• ᵕ •`)*

  • 在原始数组上操作的题目

    Move Zeros Given an array nums, write a function to move ...

  • move and rvalue

    move the move is a function to change a value to a type o...

  • Move on

    Move是这个世界实现变化的开始, 我也要对自己说,你要move,你要move,你要move! 因为我想要活得生动...

  • 移动旋转

    简介 简单总结 move CharacterController: Rigidbody:AddForce,Move...

  • vim移动一行

    :开始行, 结束行 move 目标行 例::5 move 2:2, 9 move 13 或者 dd 然后在合适的地...

  • Willpower Day10

    1.jolt VERB to move or to make sb/sth move sudde...

  • Grandmaster Chess Move by Move.p

    下载地址:Grandmaster Chess Move by Move[www.rejoiceblog.com].pdf

  • Android事件传递

    Android down事件 Android move&interupt=true Android move&in...

网友评论

      本文标题:move

      本文链接:https://www.haomeiwen.com/subject/ysdlwctx.html