Solved

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

Posted on 2007-11-17
9
221 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
 

Author Comment

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

s.begin()


?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Load and store *.pnm image file 1 76
basic hardware to learn oop advanced design patterns 3 88
gdb doesn't stop on breakpoint 2 51
max float value 3 26
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now