Boost Python—包装函数时限制参数的数量 我使用Boost Python来包装我创建的一些C++函数。我的C++函数中有一个包含22个参数。当我试图用这个函数编译我的解决方案时,Boost会抱怨,我试图弄清楚这是否仅仅是因为这个函数有太多的参数

Boost Python—包装函数时限制参数的数量 我使用Boost Python来包装我创建的一些C++函数。我的C++函数中有一个包含22个参数。当我试图用这个函数编译我的解决方案时,Boost会抱怨,我试图弄清楚这是否仅仅是因为这个函数有太多的参数,python,boost,boost-python,Python,Boost,Boost Python,有人知道是否存在这样的限制吗?我复制了下面的错误,而不是代码,因为我认为有人知道或不知道这个问题的答案——如果没有限制,我会自己尝试解决。非常感谢 这是我收到的错误消息开头的副本 1>main.cpp 1>c:\cpp_ext\boost\boost_1_47\boost\python\make_function.hpp(76): error C2780: 'boost::mpl::vector17<RT,most_derived<Target,ClassT>::

有人知道是否存在这样的限制吗?我复制了下面的错误,而不是代码,因为我认为有人知道或不知道这个问题的答案——如果没有限制,我会自己尝试解决。非常感谢

这是我收到的错误消息开头的副本

1>main.cpp

1>c:\cpp_ext\boost\boost_1_47\boost\python\make_function.hpp(76): error C2780: 'boost::mpl::vector17<RT,most_derived<Target,ClassT>::type&,T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14) volatile const,Target *)' : expects 2 arguments - 1 provided

1>c:\cpp_ext\boost\boost_1_47\boost\python\signature.hpp(236) : see declaration of 'boost::python::detail::get_signature'
1>main.cpp
1> c:\cpp\u ext\boost\boost\u 1\u 47\boost\python\make\u function.hpp(76):错误C2780:“boost::mpl::vector17 boost::python::detail::get\u签名(RT(uu thiscall ClassT:*)(T0、T1、T2、T3、T4、T5、T6、T7、T8、T9、T10、T11、T12、T13、T14)volatile常量,Target*):需要2个参数-提供1
1> c:\cpp\u ext\boost\boost\u 1\u 47\boost\python\signature.hpp(236):参见“boost::python::detail::get\u signature”的声明
最后,我得到了大约一百份错误消息的副本,非常类似于这一条:

1>c:\cpp_ext\boost\boost_1_47\boost\python\make_function.hpp(76): error C2784: 'boost::mpl::vector17<RT,ClassT&,T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14) volatile const)' : could not deduce template argument for 'RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14) volatile const' from 'std::string (__cdecl *)(const std::string &,jal::date::JULIAN_DATE,const std::string &,const std::string &,int,const std::string &,const std::string &,const std::string &,const std::string &,const std::string &,const std::string &,int,const std::string &,const std::string &,int,const std::string &,const std::string &,const std::string &,const std::string &,const std::string &,int,const std::string &)'
1>          c:\cpp_ext\boost\boost_1_47\boost\python\signature.hpp(218) : see declaration of 'boost::python::detail::get_signature'
1>c:\cpp_ext\boost\boost_1_47\boost\python\make_function.hpp(76): error C2780: 'boost::mpl::vector17<RT,most_derived<Target,ClassT>::type&,T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> boost::python::detail::get_signature(RT (__thiscall ClassT::* )(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14) volatile,Target *)' : expects 2 arguments - 1 provided
1>          c:\cpp_ext\boost\boost_1_47\boost\python\signature.hpp(236) : see declaration of 'boost::python::detail::get_signature'
1>c:\cpp\u ext\boost\boost\python\make\u function.hpp(76):错误C2784:'boost::mpl::vector17 boost::python::detail::get_签名(RT('uuuuuuThisCall ClassT:*)(T0、T1、T2、T3、T4、T5、T6、T7、T8、T9、T10、T11、T12、T13、T14)volatile常量):*:无法推断出“RT('uuuuuuuuuThisCall ClassT:*”的模板参数)(T0、T1、T2、T3、T4、T5、T6、T7、T8、T9、T10、T11、T12、T13、T14)来自“std::string”的易失性常数(const std::string&,jal::date::JULIAN_date,const std::string&,const std::string&,const std::string&,const std::string&,const std::string&,const std::string&,int,const std::string&,int,const std::string&,const std::string&,const std::string&,const std::string&,const std::string&,const std::string&,const std::string&,const std::string&环&,int,常数std::string&)'
1> c:\cpp\u ext\boost\boost\u 1\u 47\boost\python\signature.hpp(218):参见“boost::python::detail::get\u signature”的声明
1> c:\cpp\u ext\boost\boost\u 1\u 47\boost\python\make\u function.hpp(76):错误C2780:“boost::mpl::vector17 boost::python::detail::get\u签名(RT(\uu thiscall ClassT::*)(T0、T1、T2、T3、T4、T5、T6、T7、T8、T9、T10、T11、T12、T13、T14)volatile、Target*):需要提供2个参数-1
1> c:\cpp\u ext\boost\boost\u 1\u 47\boost\python\signature.hpp(236):参见“boost::python::detail::get\u signature”的声明

是的,有一个限制。根据链接,它似乎是15,但我相信你可以更改它。

太好了,谢谢你的链接!我想知道为什么他们会强加一个任意的限制,如果只是更改限制程序仍然有效…我没有找到链接中说可以更改该值的部分,你能给我指一下吗?@Derek如果没有可变模板(在新标准中),你必须手工编写每个版本,因此你必须停在某个地方。在编译不同库(包括扩展模块和Boost.Python库本身)时,使用这些宏的不同值来更改这些数字的能力这是违反ODR的。但是,我们知道没有C++实现,这种特殊的违反是可以检测到的,或者会导致任何问题。如果你真的不能做到,为什么要提出它呢?