473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

STL Container of containers

s
Can I have a STL list of lists?
Jul 19 '05 #1
4 4936

"s" <yo*********@home.with.yourself> wrote in message
news:3F***************@home.with.yourself...
Can I have a STL list of lists?


Certainly.
Jul 19 '05 #2
In article <3F***************@home.with.yourself>,
s <yo*********@home.with.yourself> wrote:
Can I have a STL list of lists?


Yep. The STL containers can store any data type, and other containers
are (at least for this purpose) no different from any other data type.

A few typedefs might make the resulting code easier to follow:

typedef std::list<mydata> my_data_list;

void foo(std::list<my_data_list> list_of_lists)
{
/*Do stuff with each list contained list_of_lists*/
}

(For more fun, you can also have, f'rexample, sets of maps of vectors.
typedef gets a *lot* more useful there.)
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
I once took on the peculiar task of going through about two and a half
million lines of C written by folks who thought of themselves as experts
(and were sometimes right). --Eric Sosman in comp.lang.c
Jul 19 '05 #3

s <yo*********@home.with.yourself> wrote in message
news:3F***************@home.with.yourself...
Can I have a STL list of lists?


Sure.

std::list<std::list<int> > listoflists;

When 'nesting' the angle brackets like this,
be sure to separate them by whitespace, else
the compiler will think they're a shift operator,
and generate an error.

-Mike

Jul 19 '05 #4

"Mike Wahler" <mk******@mkwahler.net> wrote in message
news:DU***************@newsread3.news.pas.earthlin k.net...

s <yo*********@home.with.yourself> wrote in message
news:3F***************@home.with.yourself...
Can I have a STL list of lists?


Sure.

std::list<std::list<int> > listoflists;

When 'nesting' the angle brackets like this,
be sure to separate them by whitespace, else
the compiler will think they're a shift operator,
and generate an error.


Important point!
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: forester | last post by:
lets say its common situation when object have subobjects in container and receives callbacks from contained items. and object want to move objects in containers on signal(callback). iterator is...
4
by: Ulrich Sprick | last post by:
Hi all, (DB2 V7.1 for WinNT) I am looking for a way to determine the free space in my tablespace (containers), but I can't find out. The tablespace in question is a system managed tablespace in...
4
by: duoduo | last post by:
I want to know one thing, what is best design for tablespace containers, of course, it is DB2 EE 7.2 on AIX 4.3.3. For example, I have RAID 0+1 storage (8 disks) on EMC Symmetrix. Now I need to...
3
by: jignesh shah | last post by:
Hi all, Is there a way to recover a single container if its been corrupted or mark bad without restoring whole tablespace? environment: db28.1/aix5.1/tsm/rs-6000. Regards Jignesh
7
by: CCC via DBMonster.com | last post by:
We use redirected restore to refresh test from prod on different AIX 5.2 servers. The databases have the same number, size and names of cooked containers. The only difference is the fully qualified...
4
by: Michel Esber | last post by:
Hello, LUW V8 FP 11 running Linux RH AS4 Update 3. In regards to performance and IO parallelism, does it matter if I create a tablespace with a single big container, or is it better to create...
2
by: jm.suresh | last post by:
Hi, I have containers to hold geometrical objects. The members in these containers can again be containers them self. Now, In the program I would be moving objects from one container to another....
1
by: Miked | last post by:
Hello: I'm relatively new to CSS, and I'm doing a site where I don't want to use any tables. I've gotten pretty far, and the site has the layout I want. My only problem is that I'm using the...
18
by: Goran | last post by:
Hi @ all! Again one small question due to my shakiness of what to use... What is better / smarter? private: vector<MyClass_t* itsVector; OR...
1
by: anish007 | last post by:
I have a problem with making div container height grow with respect to the other. I have basically 3 div containers, the div container named main contains the other 2 containers left and right...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.