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


Groups > comp.lang.python > #64916 > unrolled thread

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

Started byEster Lopez <ester.lopezberga@gmail.com>
First post2014-01-28 18:32 +0100
Last post2014-01-28 18:32 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

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

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

FromEster Lopez <ester.lopezberga@gmail.com>
Date2014-01-28 18:32 +0100
Subjectboost-python: exposing constructor with an array of other class as argument
Message-ID<mailman.6078.1390934503.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web