[C++-sig] Custom smart pointer with const Types

2011-10-05 Thread Holger Brandsmeier
Dear list, how should I export functions to python which return smart pointers to const-pointers, e.g. shared_ptr? For my own classes I always tried to avoid this problem by always providing a methods which returns shared_ptr. Now I need to export the following method in a class provided by some

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Dave Abrahams
on Tue Sep 20 2011, "Niall Douglas" wrote: > On 19 Sep 2011 at 17:03, Jim Bosch wrote: > >> I'd like to see support for static, template-based conversions. These >> would be defined by [partial-]specializing a traits class, and I tend to >> think they should only be invoked after attempting a

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Stefan Seefeld
On 10/05/2011 07:21 AM, Dave Abrahams wrote: > on Tue Sep 20 2011, "Niall Douglas" wrote: > >> On 19 Sep 2011 at 17:03, Jim Bosch wrote: >> >>> I'd like to see support for static, template-based conversions. These >>> would be defined by [partial-]specializing a traits class, and I tend to >>>

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Jim Bosch
On 10/05/2011 07:21 AM, Dave Abrahams wrote: on Tue Sep 20 2011, "Niall Douglas" wrote: On 19 Sep 2011 at 17:03, Jim Bosch wrote: I'd like to see support for static, template-based conversions. These would be defined by [partial-]specializing a traits class, and I tend to think they should

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Jim Bosch
On 10/05/2011 09:03 AM, Stefan Seefeld wrote: ...combined with some hints users can add to their modules. Again, I think we should favor explicit conversion policy settings over implicit ones. Sorry, I haven't yet managed to find time to sketch this out in any detail. I hope to be able to do tha

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Stefan Seefeld
On 10/05/2011 09:18 AM, Jim Bosch wrote: > > I have one (perhaps unusual) use case that's extremely important for > me: I have a templated matrix/vector/array class, and I want to define > converters between those types and numpy that work with any > combination of template parameters. I can do th

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Jim Bosch
On 10/05/2011 09:26 AM, Stefan Seefeld wrote: On 10/05/2011 09:18 AM, Jim Bosch wrote: I have one (perhaps unusual) use case that's extremely important for me: I have a templated matrix/vector/array class, and I want to define converters between those types and numpy that work with any combinat

Re: [C++-sig] Custom smart pointer with const Types

2011-10-05 Thread Jim Bosch
On 10/05/2011 03:08 AM, Holger Brandsmeier wrote: Dear list, how should I export functions to python which return smart pointers to const-pointers, e.g. shared_ptr? For my own classes I always tried to avoid this problem by always providing a methods which returns shared_ptr. Now I need to exp

Re: [C++-sig] Custom smart pointer with const Types

2011-10-05 Thread Holger Brandsmeier
Jim, how do you handle smart_ptr in boost python? Do you simply cast away the constness? For my custom smart pointer I provide a class extending to_python_converter, rcp_to_python, true> now I decided to also implement to_python_converter, rcp_to_python_const, true> where I simply cast away

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Dave Abrahams
on Wed Oct 05 2011, Jim Bosch wrote: > On 10/05/2011 07:21 AM, Dave Abrahams wrote: > >> I don't understand why you guys would want compile-time converters at >> all, really. Frankly, I think they should all be eliminated. They >> complicate the model Boost.Python needs to support and cause co

[C++-sig] How to configure makefile for different build platforms

2011-10-05 Thread David Aldrich
Hi I have a C++ application that uses Boost.Python. We build it on Centos 5.3, with Python 2.4 and Boost 1.34. Our makefile uses explicit paths to find Python and Boost. For the headers we use: PYTHON = /usr/include/python2.4 BOOST_INC = /usr/include/boost INCPATH=$(PYTHON) INCPATH+=$(BOOST_

Re: [C++-sig] Custom smart pointer with const Types

2011-10-05 Thread Jim Bosch
On 10/05/2011 11:31 AM, Holger Brandsmeier wrote: Jim, how do you handle smart_ptr in boost python? Do you simply cast away the constness? For my custom smart pointer I provide a class extending to_python_converter, rcp_to_python, true> now I decided to also implement to_python_converte

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Niall Douglas
On 5 Oct 2011 at 7:21, Dave Abrahams wrote: > >> I'd like to see support for static, template-based conversions. These > >> would be defined by [partial-]specializing a traits class, and I tend to > >> think they should only be invoked after attempting all registry-based > >> conversions. > >

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Niall Douglas
On 5 Oct 2011 at 9:18, Jim Bosch wrote: > I think this might turn into something that approaches the same mass of > complexity Niall describes, because a Python module can be imported into > several places in a hierarchy at once, and it seems we'd have to track > which instance of the module is

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Niall Douglas
On 5 Oct 2011 at 11:30, Dave Abrahams wrote: > > I think this might turn into something that approaches the same mass > > of complexity Niall describes, > > Nothing ever needs to be quite as complex as what Niall describes ;-) > > (no offense intended, Niall) And here I am thinking I am clear

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Jim Bosch
On 10/05/2011 03:28 PM, Niall Douglas wrote: On 5 Oct 2011 at 9:18, Jim Bosch wrote: I think this might turn into something that approaches the same mass of complexity Niall describes, because a Python module can be imported into several places in a hierarchy at once, and it seems we'd have to

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Jim Bosch
On 10/05/2011 11:30 AM, Dave Abrahams wrote: on Wed Oct 05 2011, Jim Bosch wrote: On 10/05/2011 07:21 AM, Dave Abrahams wrote: I don't understand why you guys would want compile-time converters at all, really. Frankly, I think they should all be eliminated. They complicate the model Boost

Re: [C++-sig] [Boost.Python v3] Conversions and Registries

2011-10-05 Thread Dave Abrahams
on Wed Oct 05 2011, "Niall Douglas" wrote: > On 5 Oct 2011 at 7:21, Dave Abrahams wrote: > > What I was proposing was that the compile-time registry is identical > to the runtime registry. I don't even know what that means. > Hence the order of lookup so a lot of the simpler conversion can b

Re: [C++-sig] How to configure makefile for different build platforms

2011-10-05 Thread Wichert Akkerman
On 2011-10-5 18:12, David Aldrich wrote: Hi I have a C++ application that uses Boost.Python. We build it on Centos 5.3, with Python 2.4 and Boost 1.34. Our makefile uses explicit paths to find Python and Boost. For the headers we use: PYTHON = /usr/include/python2.4 BOOST_INC = /usr/include/b