????????????????????????

????????4??

template<typename T>
struct IsString
{
    enum { value = false };
};
template<>
struct IsString<string>
{
    enum { value = true };
};
template<typename T1?? typename T2>
struct Base
{
    //other function
    //....
    void Func()
    {
        if(IsString<T2>::value)
        {
            cout << "specialization function" << endl;
        }
        else
        {
            cout << "primary function" << endl;
        }
    }
};

???????????????????????ж?????

????????5??

template<typename T3??  typename T4>
struct must_be_same_type
{
    enum { ret = 0 };
};
template<>
struct must_be_same_type<string?? string>
{
    enum { ret = 1 };
};
template < typename T1??typename T2 >
class Base{
public:
    //other function
    //....
    void Func(){
        if(must_be_same_type<T2?? string>::ret)
        {
            cout << "specialization function" << endl;
        }
        else
        {
            cout << "primary function" << endl;
        }
    }
};

???????????????4??????????????????????

????????????????????????????????д?????????(delegate)????????£?

template<typename return_type?? typename first_type?? typename second_type>
class CEvent
{
public:
    //other function
    //....
    return_type operator()(first_type p1?? second_type p2)
    {
        return_type ret = return_type();
        //...
        //ret = invoker(p1?? p2);
        return ret;
    }
};
void test3()
{
    CEvent<int?? int?? int> e1;
    e1(1?? 2);
    CEvent<void?? int?? int> e2;
    e2(1?? 2);
}
int main()
{
    test3();
}