제 0 순위, 만약 일반 함수가 있다면, 이 함수가 제 0 순위
제 1 순위, 함수 템플릿 중, 특수화가 있다면 특수화가 제 1순위
제 2 순위, 특수화가 없다면, 컴파일러가 1개 이상 대기 코드를 뽑은 뒤에, 이 중 가장 알맞는 코드가 2순위
template<typename T>
struct identity { typedef T type; };
template<typename T>
class CConstraint
{
public:
template <typename TL>
void Verify(int position, int* constraints);
private:
template<typename TL>
void Verify(int, int*, identity<TL>);
void Verify(int, int*, identity<int>);
void Verify(int, int*, identity<long>);
};
template<typename T>
struct ID { typedef T type; };
class CGameObject
{
public:
template<typename T>
void AddComponent(CComponent* _pCom)
{
AddComponent(_pCom, ID<T>());
}
private:
template<typename T>
void AddComponent(CComponent* _pCom, ID<T> _id);
void AddComponent(CComponent* _pCom, ID<CScript>);
//....
}