다음은 컴파일되지 않는 이유는 무엇입니까 (MSVC10 -하지만 C++이 유효하지 않다고 생각합니다), 해결 방법이 있습니까?클래스 멤버 변수의 유형으로 템플릿 클래스의 멤버 유형 사용
template <typename M>
struct MyClass
{
typedef std::vector<M>::iterator iteratorT;
iteratorT myIterator;
};
오류는 error C2146: syntax error : missing ';' before identifier 'iteratorT'
입니다. 동일한 결과를 얻으려는 다양한 변형을 시도했습니다. std::vector<M>::iterator
을 멤버 함수의 유형으로 사용할 수 있지만 멤버 변수의 유형으로 사용할 수는 없습니다.
자주 묻는 질문입니다. http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18 – AnT
감사합니다. 답변을 찾기 위해 무엇을 검색해야할지 몰랐습니다! – Zero