0

I've learned about data structures and algorithms in my university course and they taught us how to implement them. After reading some answers on SO and Quora, it seems that using the STL containers are recommended.

Fhibli
  • 43
  • 7
  • 3
    Use search, you'll find plenty of drama, holy wars, irrelevant discussions. Ex: [To STL or !STL, that is the question](http://stackoverflow.com/questions/174449/to-stl-or-stl-that-is-the-question). None of those will help you in any way though. Au contraire, note that [C++ Standard Library is not STL](http://stackoverflow.com/questions/5205491/whats-this-stl-vs-c-standard-library-fight-all-about) ;) – Ivan Aksamentov - Drop Dec 29 '15 at 03:37
  • Oh I see...from your links, it is correct to say C++ stdlib? – Fhibli Dec 29 '15 at 03:44
  • 1
    @Fhibli: the C++ Standard itself uses the term "standard library" repeatedly, but elsewhere it's not uncommon to see it capitalised a la "C++ Standard Library". "stdlib" is never used in the Standard, and would be easily confused with `stdlib.h` - a C standard library header. – Tony Delroy Dec 29 '15 at 03:50

2 Answers2

3

Unless you think you have a better knowledge of software engineering than the designers of the STL - or you have some very specific hardware requirements that they are unaware of

Martin Beckett
  • 90,457
  • 25
  • 178
  • 252
  • 2
    *"better knowledge of software engineering than the designers of the STL"* - it's not so black and white - the Standard Library (and STL it's based on) made certain design decisions that won't be well suited to *every* purpose. For example, in different circumstances a open addressing / closed hashing hash table may be very dramatically better than the Standard Library's unordered containers, both in speed and reduced memory usage. Still, trying the Standard Library versions first is sound advice - just getting experience with the Standard API is useful if you go to implement your own. – Tony Delroy Dec 29 '15 at 03:47
3

As a software engineer/developer, you should know how a particular data structure works under the hood. and you should be able to customize/invent one when you need it. that's the reason they thought you so.

But generally you won't need to reinvent the wheel. so when there are tried and tested data structures available, like the std::stack, there's no need to do it again. specially because you'll have more bug issues in your implementation than those of STL or any other well designed one like Boost.

Mehrdad
  • 1,107
  • 7
  • 15