[C++-sig] Wrapping method that returns const int& (boost::python)

Panos godlike at ancient-ritual.com
Mon Oct 25 15:34:15 CEST 2010


I have a simple test case:


class Foo
{
  public:
    const int& getX() const {return x;}
    void setX(const int& x_) {x = x_;}

  private:
    int x;
};


BOOST_PYTHON_MODULE(module)
{
  class_<Foo>("Foo")
    .def("getX", &Foo::getX)
  ;
}


The problem is that I cannot wrap getX and I get a compiler error. How
is it possible to wrap getX WITHOUT changing anything in Foo?

Thanks in advance!


Panos Christopoulos Charitos
www.ancient-ritual.com
www.anki3d.org


More information about the Cplusplus-sig mailing list