1
아래 프로그램을 VS2010에서 컴파일 할 수 없습니다. 끊임없이 컴파일하고 힙을 사용할 수 없습니다. 어떤 도움이라도 대단히 감사합니다.VS2010의 C++ 메타 프로그램 컴파일
#include <iostream>
class function_t
{
public:
virtual void operator()()=0;
};
class greet_t : public function_t
{
public:
virtual void operator()(){ std::cout << "hello world" << std::endl;}
};
template<int count, function_t** f> class loop_t
{
public:
static inline void exec()
{
(*(*f))();
loop_t< count-1, f>::exec();
}
};
function_t* f;
int _tmain(int argc, _TCHAR* argv[])
{
f = new greet_t();
loop_t<1, &f>::exec();
return 0;
}
이것은 옳습니다. 메타 프로그래밍은 재귀를 고도로 사용하며 재귀와 마찬가지로 항상 루프 종결자가 필요합니다. – DanDan
고맙습니다. – Rajamohan