Modern C++

C++/Effective Modern C++

[Effective Modern C++] Chapter 2: Auto

Item 5: Prefer auto to explicit type declarations auto를 사용하면 어떤 장점이 있는가? Auto variables must be initialized : Avoiding uninitialized variable problems auto variables는 initializer로부터 타입을 추론하기 때문에, 항상 초기화되어야 한다. 따라서, 초기화되지 않은 변수 문제로부터 벗어날 수 있다. Represent types knwon only to compilers auto는 type deduction을 사용하기 때문에, 컴파일러에만 있는 타입을 지정할 수 있다. Auto vs std::function std::function은 C++11 표준 라이브러리의 템플릿으로,..

Tuesberry
'Modern C++' 태그의 글 목록