[c++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto...

17
Effective Modern C++ Study C++ Korea

Upload: giyeon-bang

Post on 17-Jul-2015

99 views

Category:

Software


1 download

TRANSCRIPT

Page 1: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea

Page 2: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연
Page 3: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea3

Page 4: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea4

Page 5: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연
Page 6: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea

std::vector<T>의 operator[]는 T&를 반환하지만 C++에서bit에 대한 참조는 불가능하다.

highPriorty를 초기화 하기위해 bool (bool &가아니다.)로암시적형변환이일어나게된다. (내부에 bool캐스팅연산자있음)

6

Page 7: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea7

Page 8: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea8

Page 9: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea9

Page 11: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연
Page 12: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea12

Page 13: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea13

Page 14: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea14

Page 15: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea15

Page 16: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

Effective Modern C++ StudyC++ Korea16

Page 17: [C++ korea] effective modern c++ study item 6 use the explicitly typed initializer idiom when auto deduces undesired types +방기연

‘Invisible’ proxy타입은 auto의 타입을 추론하는 초기화 식에서 “잘못된” 타입으로 추론될 수 있다.

명시적인 타입 초기화자 조언은 auto가 원하는 타입으로 추론되도록 강제할 수 있다.