|
Boost : |
Subject: Re: [boost] boost::python: to-python conversion on polymorphic class
From: Dave Abrahams (dave_at_[hidden])
Date: 2010-12-12 18:04:38
At Mon, 13 Dec 2010 09:57:59 +1100,
Allan Johns wrote:
>
> Sorry I don't think I was being clear enough.
>
> I want to have the derived classes to-python convert into basic types (float
> ,string etc). In other words, I don't actually want TypedAttribute<T> to be
> directly bound at all.
Oh, I see.
> Background: I have a 'table' class that can hold various types of attributes
> (all derived from the same base class), a subset of which are just wrapper
> classes for POD types. I want these POD-based attributes to automatically
> to-python convert to the relevant types.
>
>
> I actually have this working at the moment but not by way of boost.python
> converters... I have a hand-rolled dispatcher going on (think std::map keyed
> on std::type_info), that my table class's python binding uses directly. But
> I'd rather not be duplicating boost.python functionality, if that's what I'm
> doing (it would seem more elegant, and more flexible, to do this with
> boost.python itself).
You might start by answering the question of in which way what you did
fails to work.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk