Solved

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

Posted on 2007-11-17
9
207 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

707 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

18 Experts available now in Live!

Get 1:1 Help Now