Is there a linked list in C++ that I could just #include? Or do I need to create my own if I want to use one?
+2
A:
In c++ we have the STL, Standard Template Libraries which do contain a a lot of implemantations of popular algorithms like stacks, queues, linked lists and poular searching and sorting algorithms even.....
As already told by daniel you can include it by #include< list>
manugupt1
2009-11-14 19:32:42
+10
A:
As daniel notes, yes, std::list
. Usage would be:
#include <list>
// ...
std::list<int> listOfInts;
listOfInts.push_back(1);
// ...
And so on.
You can find a complete list of STL classes here. The section you're after is 3.2, Container classes. Another useful reference of the C++ Standard Library is here.
GMan
2009-11-14 19:33:25
thanks......................
2009-11-14 20:15:38
This is a double linked list, which allows for Bidirectional traversal, the SGI STL (and some others) also define single linked lists, see http://www.sgi.com/tech/stl/Slist.html for example.
Matthieu M.
2009-11-14 20:59:19
A:
Hostile Fork
2009-11-14 21:09:25
No, I recommend developing an awareness of alternatives (especially when those alternatives are used in practice by many professional C++ programmers).
Hostile Fork
2009-12-15 01:41:02