+ All Categories
Home > Software > [C++ korea] effective modern c++ study item 1 understand template type deduction +송은두

[C++ korea] effective modern c++ study item 1 understand template type deduction +송은두

Date post: 08-Aug-2015
Category:
Upload: giyeon-bang
View: 104 times
Download: 3 times
Share this document with a friend
Popular Tags:
10
Effective Modern C++ Study C++ Korea
Transcript

Effective Modern C++ StudyC++ Korea

Effective Modern C++ StudyC++ Korea3

decltype(i)는 const intdecltype(i)는 const intdecltype(f) is bool(const Widget&)

decltype(Point::x) is intdecltype(f(w)) is bool

decltype(v) is vector<int>decltype(v[0]) is int&

Effective Modern C++ StudyC++ Korea4

Effective Modern C++ StudyC++ Korea5

Effective Modern C++ StudyC++ Korea6

Effective Modern C++ StudyC++ Korea

myWidget1의 type은WidgetmyWidget2이 type은 const Widget&

7

Effective Modern C++ StudyC++ Korea8

c++14 version c++11 version

std::forward템플릿으로사용할시 우측값매개변수에좌측값인수를넣을수있다.원래좌측값인것은좌측값으로, 원래우측값인것은우측값으로캐스팅해주는 역활

Effective Modern C++ StudyC++ Korea9

decltype(x)는 int -> f1은 int를반환

decltype((x))는 int& -> f2은 int&를 반환지역변수의 참조를반환하는 것은미정의 동작! (절대로하지 말라는얘기)

Effective Modern C++ StudyC++ Korea10


Recommended