Why learn STL library

Started by
11 comments, last by Shyr 8 years ago
I swear there's a conspiracy to very slowly wind me up going on here...

...And I love it.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
Advertisement

Would you rather

A) Learn STL and not only make your life as a programmer easier but be able to understand existing and proven efficient code, or

B) Do everything the hard way and write your own classes from scratch?

The first and keyword being "standard", as in it is part of a standard.


Don't make the mistake of assuming, as most starting game developers do, that the standard library is "too slow" or just plain to be avoided. Don't make the mistake of assuming, as most starting game developers do, that "real (game) programmers" write every line of code they've ever laid eyes on. Don't make the mistake of assuming, as most starting game developers do, that using such a pedestrian library doesn't live up to the game-developers-as-programming-gods myth, and if you do then you'll never be elite. Don't make the mistake of assuming, as most starting game developers do, that you know what needs to be optimized before you've measured it with real tools that you really know how to use.

This. I was one of those when I first started. Keep in mind that STL has already gone through more scrutiny and battle testing than your game/program (whatever it is) EVER has or ever will. Using STL isn't going to kill you unless you abuse it and/or not know how to use it properly. On that note, Ravyne is also correct about STL not being always being "perfect" for all your gamedev needs. Some things (as listed above) are not really designed for speed sake, but are often safer to use than your own solution if you don't know what you are doing. I won't pretend to be an expert here, as surely Washu would put me to shame.

Btw, did you get the job?

Shogun.

Um. To answer the OP's question, STL is just something that helps you better structure your code. It exists so that you won't have to reinvent the wheel making data structures and algorithms yourself when you need to do common tasks like sorting, copying, iterating, searching, storing, etc.

Trust me, you will be doing all of those things sooner or later.

I'm just now learning it after a few years of using C++, and I can say that it is quite useful. Honestly, I understand now that asking why I should use STL is like asking why I should use A = w*h to calculate the area. It's a "standardized" way of accomplishing a task.

By the way, if I ever see or hear someone mention STL, they usually mean "Standard Template Library".

This topic is closed to new replies.

Advertisement