[C++-sig] pyste and operator*

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Nov 8 23:08:25 CET 2004


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; }

        private:
            vertex_type         m_vertex;
        };

        ~path_storage() {};
        path_storage() {};

    };
}


Thanks,
JDH

boost_python 1.31.0 with pyste and gccxml-0.6.0



More information about the Cplusplus-sig mailing list