NC University/Advanced C++34 1일차 - new에 대해서 우리가 사용하는 new의 정확한 동작 방식 operator new() 함수를 호출해서 메모리 할당 1이 성공했을 때 생성하고자 하는 자료형이 클래스 타입이라면 생성자 호출 메모리 주소를 해당 타입으로 캐스팅해서 리턴 아래의 코드를 살펴보자. #include using namespace std; class Point { public: Point() { cout 2015. 6. 19. 1일차 - Template meta programming 정의 Compile-time 재귀(recursion)를 사용해서 임의의 연산을 수행하는 기술 재귀의 종료를 위해 템플릿 전문화 기술을 사용 ex) C++11의 std::chrono, Intel TBB, ... // primary template template struct Factorial { enum { kValue = N*Factorial::kValue }; }; // 재귀의 종료를 위해서 전문화한다. template struct Factorial { enum { kValue = 1 }; }; int main(int argc, char* argv[]) { cout 2015. 6. 18. 이전 1 ··· 6 7 8 9 다음