함수객체에 대한 내용에서 나오는 건데
template <typename RetType, typename ArgType>
class Functor
{
public:
RetType operator() (ArgType data)
{
cout << data << endl;
return RetType();
}
};
return RetType(); <-- 여기서 RetType 다음에 가로가 왜 붙는거야?
거기다 RetType() 이거 자체가 뭐야? 매개변수도 아니고 블럭 내에서 사용된것도 아닌데 밑도 끝도없이 리턴 인자로 쓰네.
Functor<bool, string> functor2;
cout << functor2("hellow") << endl;
이렇게 하니(책에 있는 코드) 실행은 잘 됨. functor2 리턴은 0 나오고.
클래스일경우 인자 아무것도 안받는 생성자 호출하는거같아보임, 예를들어 string() 하면 empty string 리턴됨