Jonathan D
Jonathan D

Reputation: 1364

What is the point of STL?

I've been programming c++ for about a year now and when i'm looking about i see lots of references to STL.

Can some one please tell me what it does?

and the advantages and disadvantageous of it?

also what does it give me over the borlands VCL or MFC?

thanks

Upvotes: 8

Views: 3327

Answers (9)

Timo Geusch
Timo Geusch

Reputation: 24351

It's the C++ standard library that gives you all sorts of very useful containers, strings, algorithms to manipulate them with etc.

The term 'STL' is outdated IMHO, what used to be the STL has become a large part of the standard library for C++.

If you are doing any serious C++ development, you will need to be familiar with this library and preferably the boost library. If you are not using it already, you're probably working at the wrong level of abstraction or you're constraining yourself to a small-ish subset of C++.

Upvotes: 23

anon
anon

Reputation:

STL stands for Standard Template Library. This was a library designed mainly by Stepanov and Lee which was then adopted as part of the C++ Standard Library. The term is gradually becoming meaningless, but covers these parts of the Standard Library:

  • containers (vectors, maps etc.)
  • iterators
  • algorithms

If you call yourself a C++ programmer, you should be familiar with all of these concepts, and the Standard Library implementation of them.

Upvotes: 4

Björn Pollex
Björn Pollex

Reputation: 76828

The STL has Iterators. Sure, collections and stuff are useful, but the power iterators is gigantic, and, in my humble opinion, makes the rest pale in comparison.

Upvotes: 0

Dirk is no longer here
Dirk is no longer here

Reputation: 368261

It gives you another acronym to toss around at cocktail parties.

Seriously, check the intro docs starting e.g. with the Wikipedia article on STL.

Upvotes: 0

Glen
Glen

Reputation: 22290

The STL is the Standard Template Library. Like any library it's a collection of code that makes your life easier by providing well tested, robust code for you to re-use.

  1. Need a collection (map, list, vector, etc) they're in the STL
  2. Need to operate on a collection (for_each, copy, transform, etc,) they're in the STL
  3. Need to do I/O, there's classes for that.

Advantages

1, You don't have to re-implement standard containers (cus you'll get it wrong anyway)

Read this book by Nicolai M.Josuttis to learn more about the STL, it's the best STL reference book out there.

Upvotes: 3

thecoshman
thecoshman

Reputation: 8650

It stands for standard template library

It is a set of functions and class that are there to save you a lot of work.

They are designed to use templates, which is where you define a function, but with out defining what data type it will work on.

for example, vector more or less lets you have dynamic arrays. when you create an instance of it, you say what type you want it to work for. This can even be your own data type (class).

Its a hard thing to think about, but it is hugely powerful and can save you loads of time.

Get reading up on it now! You want regret it.

Upvotes: 0

Two Bit Gangster
Two Bit Gangster

Reputation: 993

Wikipedia has a good overview: http://en.wikipedia.org/wiki/Standard_Template_Library

The STL fixes one big deficiency of C++ - the lack of a standard string type. This has cause innumerable headaches as there have been thousands of string implementations that don't work well together.

Upvotes: 0

Bryan Denny
Bryan Denny

Reputation: 27596

It provides common useful tools for the programmer! Iterators, algorithms, etc. Why re-invent the wheel?

Upvotes: 2

Andrey
Andrey

Reputation: 60065

"advantages and disadvantageous" compared to what? To writing all that code yourself? Is not it obvious? It has great collections and tools to work with them

Upvotes: 1

Related Questions