Skip to content

Comment on Stepanov interview: origin of STL

Comments

I using STL 8+ years, but mostly because it's a standard, not because of it's good design. In fact, combination of C++ with STL can be quite ugly and very verbose:

  //for each element in vector v
  vector<T>::const_iterator it;
  for(it = v.begin(); it != v.end(); ++it)
  {
     ...
  }
or
  // if there is element Value in vector v
  if(find(v.begin(), v.end(), Value) != v.end())
  {
    ...
  }
I'm not talking about what pain it's, to write your own custom iterators.

I ended up using my own macros to cover verboseness of STL. Boost also provide some macros to ease working with STL, like FOREACH.

In a nutshell STL is a hack stretching pointer/iterator concept to generic algorithms and data structures on the host OOP language.

The best generic data structures library I saw, was in Clu language. Clu is all about ADT (Abstract Data Types).

Absence of closures in current C++ implementation also not very favorable for generic programming.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.