Connecting Tech Pros Worldwide Forums | Help | Site Map

creating a list of lists

Uwe Ziegenhagen
Guest
 
Posts: n/a
#1: Jul 19 '05
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


Victor Bazarov
Guest
 
Posts: n/a
#2: Jul 19 '05

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


Uwe Ziegenhagen
Guest
 
Posts: n/a
#3: Jul 19 '05

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

Mike Wahler
Guest
 
Posts: n/a
#4: Jul 19 '05

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