Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

class hello {
  public:
  hello() {std::cout << "init" << std::endl;}
  hello(const hello& rhs) {std::cout << "copy" << std::endl;}
  hello(hello&& rhs) {std::cout << "move" << std::endl;}
  hello(const hello&& rhs) {std::cout << "copy?move?" << std::endl;}
};

template <typename T>
void f(const T&& param) { std::cout << "param" << std::endl; }

int main() {
  hello h;
  const hello h2;
  hello h3(h);
  hello h4(std::move(h));
  hello h5(std::move(h2));

  const int i = 1;
  f(1);
  f(i);
}
gcc version 4.6.3