19
template <size_t size, typename ...Params>
void doStuff(Params...) {
}
template <>
void doStuff<size_t(1), int, bool>(int, bool) {
}
int main(int, char**) {
doStuff<1,int,bool>(1, false);
return 0;
}
두 번째 doStuff 선언은 error: template-id ‘doStuff<1u, int, bool>’ for ‘void doStuff(int, bool)’ does not match any template declaration
을 제공하지만 첫 번째 선언을 가변 템플릿 인수와 명확하게 일치시킵니다.가변 템플릿을 사용한 템플릿 전문
가변 특성 템플릿을 특수화하는 방법은 무엇입니까?
저는 gcc 4.5.2를 사용합니다. 귀하의 답변을 주셔서 감사합니다 (지금 템플릿 오버로딩을 사용하고 있습니다). – coyotte508
4.6.1과 동일합니다. 즉 위 버전은 해당 버전에서 지원되지 않습니다 ... – Nim
또는 템플릿 <..> 구조체 Do (static void Stuff (..) {}};')에 함수를 래핑 할 수 있습니다. –