2012-10-02 97 views
0

任何人都可以找到第一次重載和所需函數之間的區別嗎?如果我註釋掉Python規範,編譯很好,但我在其他地方需要它。共鬱悶...重載模板函數模糊問題

template<typename TN> 
void fromVectorTo(const std::vector<TN> & input, xlw::impl::XlfOper<xlw::LPXLFOPER> * output){....} 
template<typename TN> 
void fromVectorTo(const std::vector<TN> & input, PyObject ** output){...} 

error C2665: 'pal::fromVectorTo' : none of the 2 overloads could convert all the argument types 
8>  myPython.h(73): could be 'void pal::fromVectorTo<double>(const std::vector<_Ty> &,PyObject **)' 
8>  with 
8>  [ 
8>   _Ty=double 
8>  ] 
8>  myXLW.h(102): or  'void pal::fromVectorTo<double>(const std::vector<_Ty> &,xlw::impl::XlfOper<LPOPER_TYPE> *)' 
8>  with 
8>  [ 
8>   _Ty=double, 
8>   LPOPER_TYPE=xlw::LPXLFOPER 
8>  ] 
8>  while trying to match the argument list '(const std::vector<_Ty>, xlw::impl::XlfOper<LPOPER_TYPE> *)' 
8>  with 
8>  [ 
8>   _Ty=double 
8>  ] 
8>  and 
8>  [ 
8>   LPOPER_TYPE=xlw::LPXLFOPER 
8>  ] 

回答

0

看起來這是一個編譯器錯誤 - 錯誤消息肯定是錯誤的。當我使用模板類的局部特化+做其他修改時,問題似乎消失了。