Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64916

boost-python: exposing constructor with an array of other class as argument

Date 2014-01-28 18:32 +0100
Subject boost-python: exposing constructor with an array of other class as argument
From Ester Lopez <ester.lopezberga@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.6078.1390934503.18130.python-list@python.org> (permalink)

Show all headers | View raw


Hello there,

I have two different classes that I want to expose using boost-python,
but the constructor of the second class takes and array of the first
one as argument and I can't figure out how to do it.

This is the definition of the classes:

    class INT96{
    public:
        uint64_t value[3];
        INT96(){};
        INT96(uint64_t x0, uint64_t x1, uint64_t x2);
        ...
    };
    template <unsigned k>
    class Xi_CW{
        protected:
            INT96 A[k];
        public:
            Xi_CW(INT96 (&A)[k]);
            ...
    };

And my attempt to expose them using boost-python:

    using namespace boost::python;
    typedef Xi_CW<4> Xi_CW4;
    BOOST_PYTHON_MODULE(xis)
    {
        class_<INT96>("INT96", init<double,double,double>())
            [...]
        ;
        class_<Xi_CW4>("Xi_CW4", init<INT96[4]>())
            [...]
        ;
    }

Which results in a "no known conversion error". I've tried several
other possibilities but so far no luck...

Any idea how should I do it? Thanks

Ester

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

boost-python: exposing constructor with an array of other class as argument Ester Lopez <ester.lopezberga@gmail.com> - 2014-01-28 18:32 +0100

csiph-web