Standard Template Library?

Started by
3 comments, last by Spartacus 23 years, 4 months ago
Hi... Can someone please tell me about STL and what i can use it for. Is it just a huge collection of frequently used stuff like vectors and strings? When i write std:: in VC++ 6 i see this BIIIG list of functions, templates, structs and variables. Then i take a look at std::string where every function has a minimum of 5 overloads, and everything just seems sooo complicated. Can someone maybe refer to a place on the net where i can find good documentation on STL? And would it be a good idea to use STL instead of writing everything myself as i use to do? Any help is greatly appreciated. -René Petersen

Real programmers don't document, if it was hard to write it should be hard to understand

Advertisement
This explains it better than I ever could.

LINK!

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
As an avid STL user, I can give you some thoughts about which templates to focus on, at least in the beginning. There are a lot of STL templates, and not all of them are widely useful for games (or at least, i''ve been able to get along without them).

vector (resizeable array)
list (linked list)
basic_string (string type--yes, its compatible with C string functions)
map (exchanges values of one type into another type, like basic_string to a void*)

Get off my lawn!

While TANSTAAFL doesn''t need my approval, I will ring in and say that I''m in complete agreement with the advice he gave you. I''d suggest that you play with vectors or basic_string before you move on to anything else. Reason being, most books I''ve read and from what I can remember when learning C++ years ago, strings and arrays themselves are what you spent a lot of time playing around with example programs while you learned C++. It''s easy to comprehend what those containers are and what there doing and how operations work on them.

As with all blanket statments there are going to be exceptions here and there so with that in mind, if you know one container you know them all...

YAP-YFIO,
deadlinegrunt

~deadlinegrunt

I''d have to add priority_queue to the list of must know containers in the STL. (If I see one more programmer implement heap operations on a vector....)

Of course the templated algorithms are just as useful as the templated containers. Ex: random_shuffle, accumulate, sort, inner_product, for_each, etc.

Also function objects are a lot more useful than they appear at first.

(Take this all with a grain of salt, I personally can''t stand the STL, but if you''re going to use it, use it right.)

This topic is closed to new replies.

Advertisement