0

템플릿 템플릿 매개 변수로 실험하고 있습니다. 클래스와 함께 작동하게하는데 아무런 문제가 없지만 어떤 이유로 함수에서 작동하지 않습니다.무료 기능을위한 템플릿 매개 변수

enum class MyEnum { A, B, C, D}; 

    template<class EnumType, template<EnumType> class Fun > 
    class MyTest 
    { 
    } 

    template<MyEnum myEnum> 
     void freeFunc(int argument) 
     { 
     LOG_ERROR(" void freeFunc(int argument) default case!!! "); 
     } 

     template<> 
     void freeFunc<MyEnum::A>(int argument); // implemented in cpp 

     template<> 
     void freeFunc<MyEnum::B>(int argument); // implemented in cpp 

     template<> 
     void freeFunc<MyEnum::C>(int argument); // implemented in cpp 

     template<> 
     void freeFunc<MyEnum::D>(int argument); // implemented in cpp 


template<MyEnum s> 
class Cde 
    { 
    public: 
    }; 


    MyTest<MyEnum, Cde > test1; // does compile 

    MyTest<MyEnum, freeFunc > test2; // does not compile 

나는 test2가 컴파일되지 않는 이유를 모르겠다. 그냥 말합니다 : 오류 : 'freeFunc'클래스 템플릿이 필요합니다

내가 뭘 잘못하고 있니?

[편집] 내가 무엇을 찾고 있어요 것은 모두 템플릿 기능

+0

왜 컴파일됩니까? 'freeFunc'는 타입'템플릿 class Fun' ... – jpo38

+0

과 일치하지 않습니다. 왜 Cde가 그랬습니까? 그것도 같은 종류의 서명 같아요 – user3770392

+0

@ user3770392 Cde는 클래스 – marcinj

답변

1

참고 열거 클래스에 플릿 무료 기능과 클래스 템플릿은 template template argument으로 사용할 수 없습니다 얻을 수있는 일반적인 방법을 얻을 수있는 방법이다,

A template argument for a template template parameter must be an id-expression which names a class template or a template alias.

+0

빌어 먹을 .. 기본적으로 내가 붙어있어 : / – user3770392