0
간결함을 위해 명시 적 인스턴스화에서 템플릿 인수의 이름을 한 번만 지정하고 싶지만 컴파일러 오류가 발생합니다. Type alias, alias template
아래의 cppreference에 설명 된대로 C++ 구문을 사용하려고합니다. 여기 내 샘플 코드는 다음과 같습니다.템플릿 선언에서 중복 템플릿 인수를 제거하는 방법
struct M {};
template< typename T1 >
struct S {};
template< typename T2, typename T3 >
struct N {};
// type alias used to hide a template parameter (from cppreference under 'Type alias, alias template')
//template< typename U1, typename U2 >
//using NN = N< U1, U2<U1> >; // error: attempt at applying alias syntax: error C2947: expecting '>' to terminate template-argument-list, found '<'
int main()
{
N< M, S<M> > nn1; // OK: explicit instantiation with full declaration, but would like to not have to use M twice
// NN< M, S > nn2; // desired declaration, error: error C2947: expecting '>' to terminate template-argument-list, found '<'
return 0;
}
무엇이 문제입니까?