Solved

[noob][c++]  how do I establish a list ?

Posted on 2007-11-17
9
238 Views
Last Modified: 2010-04-01
for starting a set,


what I need is this


      set<int, greater<int> > s;
      set<int, greater<int> >::iterator i;




i want something as simple that above for list

and then i ll start a thread about lists' accessors and mutators.
0
Comment
Question by:Troudeloup
  • 3
  • 3
  • 3
9 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 300 total points
ID: 20305728
list<int> l;
list<int>::iterator i;


Did yo utake a look at the link I listed earlier ? You can get all the information on containers you need and a lot more there :

        http://www.cplusplus.com/reference/stl/

It will be a lot easier for you, and you'll learn a lot more by just reading that.
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 200 total points
ID: 20305730
the minimum you require for a list is:

list<int> l;
list<int>::iterator i;

i = l.begin();
access first element in list with *i
0
 

Author Comment

by:Troudeloup
ID: 20305734
i don't why, i have phobia toward that kind of links
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Troudeloup
ID: 20305739
oh, so first I have to point the iterator somewhere by doing, for instance

s.begin()


?
0
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 300 total points
ID: 20305741
>> i don't why, i have phobia toward that kind of links

What do you mean ? It's a reference site for all STL containers. It groups all the information and makes it easily accessible. If I were you, I'd get over your phobia, because it's really the easiest way to get this kind of information.
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 200 total points
ID: 20305744
>>oh, so first I have to point the iterator somewhere by doing, for instance
>>s.begin()

yes
0
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 300 total points
ID: 20305750
>> oh, so first I have to point the iterator somewhere by doing, for instance

Troudeloup, you seem to be very confused about containers. Really : read up on them first. That will already answer a lot of your questions.

Right now, you're just jumping around blindly, without really knowing what it's all about.
0
 

Author Comment

by:Troudeloup
ID: 20305759
ok.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20305763
Indeed this is an experts forum, so you have to read all the theory first to have some level of expertise, then post here the hard questions.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question