[C++-sig] init from free function instead of constructor

John Reid j.reid at mail.cryst.bbk.ac.uk
Wed Jan 24 20:52:41 CET 2007


Hmmm well it sounds helpful and looks interesting but I get some 
compilation errors. I found this thread from 2004 saying the docs are 
wrong: http://aspn.activestate.com/ASPN/Mail/Message/cpp-sig/2262368
I think the thread is right and the docs are wrong :(. At least the docs 
don't agree with the header file.

The code I have is essentially what you suggested. The errors I get are 
(if you substitute bio::TableLink for X and detail::make_table_link for 
make_x):

C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/pointee.hpp(28) : 
error C2039: 'element_type' : is not a member of 'bio::TableLink'
         ..\Bio\bio/common.h(82) : see declaration of 'bio::TableLink'
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/pointee.hpp(38) : 
see reference to class template instantiation 
'boost::python::detail::pointee_impl<false>::apply<T>' being compiled
         with
         [
             T=bio::TableLink
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/make_constructor.hpp(54) 
: see reference to class template instantiation 
'boost::python::pointee<T>' being compiled
         with
         [
             T=bio::TableLink
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/make_constructor.hpp(39) 
: see reference to function template instantiation 'void 
boost::python::detail::install_holder<T>::dispatch<T>(Ptr,boost::mpl::false_) 
const' being compiled
         with
         [
             T=result_t,
             Ptr=result_t
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/make_constructor.hpp(38) 
: while compiling class template member function 'PyObject 
*boost::python::detail::install_holder<T>::operator ()(T) const'
         with
         [
             T=result_t
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/detail/caller.hpp(196) 
: see reference to class template instantiation 
'boost::python::detail::install_holder<T>' being compiled
         with
         [
             T=result_t
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/detail/caller.hpp(176) 
: while compiling class template member function 'PyObject 
*boost::python::detail::caller_arity<0>::impl<F,Policies,Sig>::operator 
()(PyObject *,PyObject *)'
         with
         [
             F=bio::TableLink (__cdecl *)(void),
             Policies=inner_policy,
             Sig=boost::mpl::vector1<bio::TableLink>
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/detail/caller.hpp(145) 
: see reference to class template instantiation 
'boost::python::detail::caller_arity<0>::impl<F,Policies,Sig>' being 
compiled
         with
         [
             F=bio::TableLink (__cdecl *)(void),
             Policies=inner_policy,
             Sig=boost::mpl::vector1<bio::TableLink>
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/make_constructor.hpp(152) 
: see reference to class template instantiation 
'boost::python::detail::caller<F,CallPolicies,Sig>' being compiled
         with
         [
             F=bio::TableLink (__cdecl *)(void),
             CallPolicies=inner_policy,
             Sig=boost::mpl::vector1<bio::TableLink>
         ]
 
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/make_constructor.hpp(230) 
: see reference to function template instantiation 
'boost::python::api::object 
boost::python::detail::make_constructor_aux<bio::TableLink(__cdecl 
*)(void),boost::python::default_call_policies,boost::mpl::vector1<T0>>(F,const 
CallPolicies &,const Sig &)' being compiled
         with
         [
             T0=bio::TableLink,
             F=bio::TableLink (__cdecl *)(void),
             CallPolicies=boost::python::default_call_policies,
             Sig=boost::mpl::vector1<bio::TableLink>
         ]
         python_transfac.cpp(133) : see reference to function template 
instantiation 'boost::python::api::object 
boost::python::make_constructor<bio::TableLink(__cdecl *)(void)>(F)' 
being compiled
         with
         [
             F=bio::TableLink (__cdecl *)(void)
         ]
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/pointee.hpp(28) : 
error C2146: syntax error : missing ';' before identifier 'type'
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/pointee.hpp(28) : 
error C4430: missing type specifier - int assumed. Note: C++ does not 
support default-int
C:\Dev\ThirdParty\boost\RC_1_34_0\boost\boost/python/pointee.hpp(28) : 
error C2208: 'boost::type' : no members defined using this type
     call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" 
x86 >nul


Any more help appreciated...

John.




More information about the Cplusplus-sig mailing list