@TaeHunKim/

EffectiveCppItem23

C++11

No description

fork
loading
Files
  • main.cpp

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.006548216423483799","path":"main.cpp","file":{"path":"main.cpp","content":{"asEncoding":{"base64":"I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgaGVsbG8gewogIHB1YmxpYzoKICBoZWxsbygpIHtzdGQ6OmNvdXQgPDwgImluaXQiIDw8IHN0ZDo6ZW5kbDt9CiAgaGVsbG8oY29uc3QgaGVsbG8mIHJocykge3N0ZDo6Y291dCA8PCAiY29weSIgPDwgc3RkOjplbmRsO30KICBoZWxsbyhoZWxsbyYmIHJocykge3N0ZDo6Y291dCA8PCAibW92ZSIgPDwgc3RkOjplbmRsO30KICBoZWxsbyhjb25zdCBoZWxsbyYmIHJocykge3N0ZDo6Y291dCA8PCAiY29weT9tb3ZlPyIgPDwgc3RkOjplbmRsO30KfTsKCnRlbXBsYXRlIDx0eXBlbmFtZSBUPgp2b2lkIGYoY29uc3QgVCYmIHBhcmFtKSB7IHN0ZDo6Y291dCA8PCAicGFyYW0iIDw8IHN0ZDo6ZW5kbDsgfQoKaW50IG1haW4oKSB7CiAgaGVsbG8gaDsKICBjb25zdCBoZWxsbyBoMjsKICBoZWxsbyBoMyhoKTsKICBoZWxsbyBoNChzdGQ6Om1vdmUoaCkpOwogIGhlbGxvIGg1KHN0ZDo6bW92ZShoMikpOwoKICBjb25zdCBpbnQgaSA9IDE7CiAgZigxKTsKICBmKGkpOwp9"},"asBuffer":null},"loaded":true}}
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);
}