[C++-sig] Re: conversion of python dictionary to shared_ptrs
David Abrahams
dave at boost-consulting.com
Sun Apr 4 04:20:42 CEST 2004
"aashish" <aashish at vrac.iastate.edu> writes:
> Hi,
>
> I need to pass a dictionary from python to C++ function which is defined as
>
> void setVariables(ValueMapPtr variables);
>
> where I have typedef ValueMapPtr as
>
> //a shared ptr of a value map
> typedef boost::shared_ptr< ValueMap > ValueMapPtr;
>
> // And
> typedef std::map< std::string, std::vector<double> > ValueMap;
>
>
> Is it possible??
Yes.
> Do I need to use register_ptr_to_python ?
No; if it's truly a Python dictionary on the Python side, you need to
build a custom rvalue from-python converter, per
http://www.boost.org/libs/python/doc/v2/faq.html#question2
http://article.gmane.org/gmane.comp.python.c%2B%2B/2161
I wish it were easier; sorry!
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list