Solved

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

Posted on 2007-11-17
9
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

751 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