gpt4 book ai didi

c++ - 重载模板函数歧义性问题

转载 作者:行者123 更新时间:2023-12-02 11:05:48 25 4
gpt4 key购买 nike

有人能找到第一重载与所需功能之间的区别吗?如果我注释掉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> ]

最佳答案

看起来这是一个编译器错误-错误消息一定是错误的。当我使用模板类的特殊特化+做其他修改时,问题似乎消失了。

关于c++ - 重载模板函数歧义性问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12692592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com