2013년 독서 목록
c++ 몇가지
- template의 dependent typename을 사용할 때 typename keyword를 써야 한다.
예)
template
void foo(T bar) {
typedef typename T::type value_t; // T::type은 template parameter인 T에 dependent
}
- template의 parameter type은 런타임이 아닌 컴파일타임에 결정되는 걸 잊지 말 것. 또한 template 클래스나 함수 구현시 parameter를 명시해야 하는 것도 잊지 말 것.3. const member 함수 안에서는 this 포인터가 const로 동작한다. member 변수도 마찬가지이다. 그러므로 member 변수에 대해 부르는 함수도 const가 되어야 한다.예)class foo {void bar() const {baz.blah(); // baz가 blah()를 호출할 때 this 포인터가 const로 동작하므로 blah()도 const여야 한다.}Baz baz;}