我有四個功能:曖昧的函數的調用
template<class Exception,class Argument>
void allocate_help(const Argument& arg,Int2Type<true>)const;
template<class Exception,class Argument>
std::nullptr_t allocate_help(const Argument& arg,Int2Type<false>)const;
template<class Exception>
void allocate_help(const Exception& ex,Int2Type<true>)const;
template<class Exception>
std::nullptr_t allocate_help(const Exception& ex,Int2Type<false>)const;
但是當我打電話:
allocate_help<std::bad_alloc>(e,Int2Type<true>()); //here e is of a std::bad_alloc type
我得到一個錯誤:
錯誤3錯誤C2668:曖昧調用超載功能 爲什麼?
+1,但他們沒有完全相同的簽名,第二個版本是第一個,在類型`Exception`和`Argument`是相同的一個子集。模板參數「Exception」的任何調用和函數調用的第一個參數的類型都不會是模糊的。 – 2010-12-01 17:08:43