[C++-sig] pure virtuals and properties

Luca Sbardella luca.sbardella at gmail.com
Thu Apr 26 12:35:03 CEST 2007


Hi, just a quick question on the use o "wrapper.hpp".
I have the following class and its correspondent wrapper class

class blah
{
public:
  virtual double ciao() const = 0;
};

class blah_wrapper : public blah, public boost::python::wrapper<blah>
{
public:
   double ciao() const  { return
boost::python::call<double>(this->get_override("ciao").ptr()); }
};

I would like to expose the "ciao" method as a property

class_<blah_wrapper, boost::noncopyable>("blah")
.add_property("ciao",      pure_virtual(&blah::ciao))
;

but it doesn't compile... lots of template errors (by the way is there a way
to use "textfilt" http://textfilt.sourceforge.net/ in visual studio?)
This, on the other hand, does compile as expected

class_<blah_wrapper, boost::noncopyable>("blah")
.def("ciao",             pure_virtual(&blah::ciao))
;

I guess we cannot expose e pure virtual function as property, or is there
something I'm missing?
Thanks
Luca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070426/f5f2517f/attachment.htm>


More information about the Cplusplus-sig mailing list