[C++-sig] pyste and operator*

Roman Yakovenko roman.yakovenko at gmail.com
Tue Nov 9 05:56:59 CET 2004


On Mon, 08 Nov 2004 16:08:25 -0600, John Hunter
<jdhunter at nitace.bsd.uchicago.edu> wrote:
> 
> I have a class agg::path_storage which nests another class
> agg::path_storage::const_iterator that defines operator*().  When I
> run pyste on this file, I get a compile time error
> 
> src/test.cpp: In function `void init_module_tagg()':
> src/test.cpp:22: error: no match for 'operator*' in '*
>    boost::python::self_ns::self'
> error: command 'gcc' failed with exit status 1
> 
> The part of the boost generated code that is failing is the .def(
> *self ) line in
> 
>     class_< agg::path_storage::const_iterator >("const_iterator", init<  >())
>         .def(init< const agg::path_storage::const_iterator& >())
>         .def( *self )
>     ;
> 
> I tried removing operator* in pyste, but did not succeed.  Here is my
> complete test.pyste file
> 
> PS = Class("agg::path_storage", "test.h")
> CI = Class("agg::path_storage::const_iterator", "test.h")
> exclude(CI.operator['*'])
> 
> and here is the minimal test.h example code that is failing
> 
> namespace agg
> {
>     struct vertex_type
>     {
>         double   x, y;
>         unsigned cmd;
> 
>         vertex_type() {}
>         vertex_type(double x_, double y_, unsigned cmd_) :
>             x(x_), y(y_), cmd(cmd_) {}
>     };
> 
>     class path_storage
>     {
>     public:
> 
>         class const_iterator
>         {
> 
>         public:
>             const_iterator() {}
>             const vertex_type& operator*() const { return m_vertex; }

This operation is meaningless \doesn't exis in python. If  you still
want to expose
it - expose it as regular function

> 
>         private:
>             vertex_type         m_vertex;
>         };
> 
>         ~path_storage() {};
>         path_storage() {};
> 
>     };
> }
> 
> Thanks,
> JDH
> 
> boost_python 1.31.0 with pyste and gccxml-0.6.0
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>



More information about the Cplusplus-sig mailing list