What my uni course thinks of the Standard Template Library

0 favourites
  • 8 posts
From the Asset Store
Fruit Slicer Template & Quality fruit and slice graphics (capx,c3p,png,illustrator files)
  • <img src="http://img135.imageshack.us/img135/5851/stllol.jpg">

    What do fellow programmers think?

  • "It is clunky"

    It's the fastest and best optimised set of classes for arrays, maps, etc that I know to exist..

    "Method names are often verbose"

    This is a good thing, and in a time when every single - even ten year old - development environments have intellisense, what is the problem? Better to have full names than to shorten them and confuse.

    "Use of methods is rarely intuitive"

    Sometimes I feel inclined to agree with this; I find myself ocassionally looking at documentation for it, but on the whole it's no harder than any other library.

    "..no bounds checking.."

    I'm not sure what to make of this; it seems to be a design decision whether libraries error check, though I'd argue that for the sake of speed and streamlining - as well as programmer control in some instances - that for STL, this is the right way to go (for other libraries it may well not be).

    "Names of methods and classes aren't mainstream"

    Why aren't they? There's no example cited, but the storage classes at least seem to be suitably named.


    I used to be a fan of not using iterators, but since I've used them I can see their advantages; they're quicker and more intuitive than looping and looking up via indexes.

    Seems like a load of tosh.

  • the no bounds thing is wrong. In debug mode, it checks for you, and if your out it crashes with an error

  • Yeah, that's what I meant; I think they mean that it should check bounds in release/debug and stop a crash/exception, which is totally wrong for a library like this. It should present you with every bug you should have, not hide them.

  • <img src="http://www.artie.com/20001014/arg-exploding-head-guy-lg-border-url.gif">

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well put.. my biggest worry is that people like this may transfer these views onto students; they shouldn't be allowed to teach such crap, even if they don't like STL.


    This is wrong, wrong, wrong, wrong! You should definitely at least link them to this thread. They need to know why that is wrong.

    "The main problem with the STL is that it was clearly written by a committee"

    Why is that clear? Which committee wrote it? What suffered as a result? As an interesting thing to note, my copy of the <vector> header has the copyright notice "Copyright (c) 1992-2008 by P.J. Plauger". Written by a committee or written by one guy?

    "It is clunky"

    Why? What does 'clunky' mean? Does it mean slow? The source code is available, meaning the compiler can make optimisation and inlining decisions that are impossible when using .lib libraries. This actually makes it extremely fast. I once tried to write my own container faster than vector. I thought it'd be easy, and took lots of dangerous shortcuts to make it faster. It was slower. Does clunky mean badly designed? The STL is one of the best designed libraries out there, probably ahead of its time too.

    "Method names are often verbose"

    Which method names? find? begin? end? front? back? copy? sort? Verbose? Is this a joke?

    If you don't like the std:: prefix, stick using std::find at the top and you can use find like a global function.

    "Use of methods is rarely intuitive"

    Which methods? Is my_vector.pop_back() to remove the last element really something hard to get your head round?

    No bounds checking is done on arrays(vectors)

    Incorrect. vector::operator[] does not bounds check, which is a deliberate decision. vector::at() bounds checks, and throws out_of_range exceptions if you pass an invalid index. Also, iterators are bounds checked in debug mode, so i++ will throw an exception if you're already at the end of an array. If it was a pointer, I'd be running in to undefined memory and left pretty clueless about what the problem is. This has saved my ass many a time.

    The names of methods and classes is often non-mainstream

    You mean, everyone in the world agreeing that a vector is called a vector isn't mainstream? Again, I point to find as well.

    Iterators are used instead of pointers

    A strong benefit instead of a problem. As mentioned, they are bounds checked when debugging, so you can never have an iterator to random memory (how many pointers have you had pointing to nowhere?). They are equally as fast as using pointers. The syntax is also identical for any container. Whether you're using a binary tree, a linked list or a contiguous array, i++ means move to the next element, wherever it is. This simplifies the readability of code greatly, and also means if I suddenly decide I want to use a vector instead of a linked list for my container, I just need to change a few typedefs. I wouldn't even need to change any code! Better yet, the syntax is pretty much identical to that of pointers. I don't get why this is listed as a problem.

    Does not always interface well with C++

    Like where? The containers support any C++ object with the proper copy constructors and such, and they even work combined with normal C arrays.

    In short, this is obviously not researched at all, just a list of completely fabricated "problems", and is amazingly inaccurate. Every C++ programmer should learn and use the STL.

  • I like pumpkin pie.


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)