[C++-sig] Re: How to extract a sublist from a list in C++ ?

David Abrahams dave at boost-consulting.com
Wed Dec 8 19:10:14 CET 2004


PJ Durai wrote:
> Greetings,
> 
> I couldnt figure out the following bit.
> 
> Say I am passing a list of lists.   [ [a, b] , [c,d]]  to a method in a C++ 
> object.
> 
> In the C++ class,
> 
> void ParseList (list lst)
> {
>    object o = lst[0];

What about

     list l1(lst[0])

??

>    // how do I conver 'o' to a list again?
>    list l1  = extract<list> (o);   <- naive attempt. but doesnt work.

What happens?

> }


-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list