[C++-sig] get_overload raising cannot convert from 'boost::python::detail::method_result' to 'MMOT::Geometry &'

troy d. straszheim troy at resophonic.com
Mon Sep 7 06:41:08 CEST 2009


Freyr Magnússon wrote:
> I trying to create an interface wrapper for a class and I get an error:
> 
> cannot convert from 'boost::python::detail::method_result' to 
> 'MMOT::Geometry &'
> 

Checking the code, I see method_result has a workaround for the 
conversion-operator-to-reference:

class method_result {
   // ...
#  if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) || 
BOOST_WORKAROUND(BOOST_INTEL_WIN, >= 900)
       // No operator T&
#  else

       template <class T>
       operator T&() const
       {
           converter::return_from_python<T&> converter;
           return converter(const_cast<handle<>&>(m_obj).release());
       }
#  endif
};

If this is why this:

>     Geometry& getGeometry()
>     {
>         return this->get_override("getGeometry")();
>     }

Doesn't work (I don't know what that workaround means offhand but I'm 
going to guess it refers to old MSVC platforms), you could try

    Geometry* result = this->get_override("getGeometry")();
    return *result;

So... what compiler are you using?

-t



More information about the Cplusplus-sig mailing list