Hello Marco, 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> g] On Behalf Of Marco Aschwanden
> Sent: Tuesday, March 21, 2006 8:43 PM
> Subject: From Python to c++
> 
> parsed = {
>   "name":["Mac", "Mike"],
>   "age":[25, 55],
>   "place":["Zurich", "Oslo"]
> }
> 
> map<string, vector<???> >
> 
> I want to build the map of lists dynamically - it can have 
> many fields or  
> just one... and I would like to have simple interface (as 
> Python offers).


If you can predetermine the possible types of the data fields at compile time 
(I don't know how to avoid this constraint anyway because you need to convert 
the string data to the field types, as well in Python as in C++) you could use:

std::map< std::string, boost::variant< std::string, int, bool > > parsed;

if your predetermined types are string, int, bool.

For more info, see http://www.boost.org/.


HTH,

aa

-- 
Andreas Ames | Programmer | Comergo GmbH |
Voice:  +49 69 7505 3213 | ames AT avaya . com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to