Connecting Tech Pros Worldwide Help | Site Map

creating a list of lists

  #1  
Old July 19th, 2005, 05:19 PM
Uwe Ziegenhagen
Guest
 
Posts: n/a
Hi folks,

one question:

I try to create a list of lists, using

std::list<std::list> testlist;

but BCC 6 complains:

cannot generate template-specialization from __STL::list<_Tp,_Alloc>

How ist it done coreectly? My knowledge of C++ is still growing...


Uwe

  #2  
Old July 19th, 2005, 05:19 PM
Victor Bazarov
Guest
 
Posts: n/a

re: creating a list of lists


"Uwe Ziegenhagen" <isestd14@wiwi.hu-berlin.de> wrote...[color=blue]
> one question:
>
> I try to create a list of lists, using
>
> std::list<std::list> testlist;
>
> but BCC 6 complains:
>
> cannot generate template-specialization from __STL::list<_Tp,_Alloc>
>
> How ist it done coreectly? My knowledge of C++ is still growing...[/color]

You want to create a list of lists of WHAT? For example,
a list of lists of integers is created this way:

std::list<std::list<int> > listoflistsofints;

Victor


  #3  
Old July 19th, 2005, 05:19 PM
Uwe Ziegenhagen
Guest
 
Posts: n/a

re: creating a list of lists


Uwe Ziegenhagen wrote:[color=blue]
> Hi folks,
>
> one question:
>
> I try to create a list of lists, using
>
> std::list<std::list> testlist;
>
> but BCC 6 complains:
>
> cannot generate template-specialization from __STL::list<_Tp,_Alloc>
>
> How ist it done coreectly? My knowledge of C++ is still growing...
>
>
> Uwe
>[/color]

just found out:

std::list<std::list<double> > testlist;

uwe

  #4  
Old July 19th, 2005, 05:20 PM
Mike Wahler
Guest
 
Posts: n/a

re: creating a list of lists



Uwe Ziegenhagen <isestd14@wiwi.hu-berlin.de> wrote in message
news:bhbb7s$90i$1@lnews.rz.hu-berlin.de...[color=blue]
> Hi folks,
>
> one question:
>
> I try to create a list of lists, using
>
> std::list<std::list> testlist;[/color]

'std::list' requires a template argument.
The second one doesn't have one.
[color=blue]
>
> but BCC 6 complains:
>
> cannot generate template-specialization from __STL::list<_Tp,_Alloc>
>
> How ist it done coreectly? My knowledge of C++ is still growing...[/color]

std::list<std::list<type> > a_list_of_lists;

-Mike



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating and appending to a dictionary of a list of lists pyscottishguy@hotmail.com answers 2 August 15th, 2007 02:05 PM
Sorting a List of Lists apotheos@gmail.com answers 7 January 31st, 2007 08:25 PM
Efficient lookup in list of dictionaries David Pratt answers 2 December 5th, 2005 09:45 AM
Indexing list of lists Hilde Roth answers 21 July 18th, 2005 03:52 AM