Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why some libraries must implement basic data structure? [closed]

Some open source libraries have tendency to re implement basic structures like string, list, stack, queue... Why don't they use stl library? Is stl not good enough?

like image 463
tiboo Avatar asked Mar 10 '10 04:03

tiboo


2 Answers

C++ as a language existed for many years before the STL was standardized and for several more years before the STL was implemented consistently across all compilers. Libraries that were originally written during that time may not have wanted to rely on the STL in order to be more portable.

Another reason related to portability is embedded use. Qt, for example, re-implements most of the STL because Qt applications are sometimes targeted at embedded platforms (e.g. Nokia smartphones) which may not have an STL implementation available.

like image 90
Tyler McHenry Avatar answered Nov 04 '22 09:11

Tyler McHenry


Exposing STL types in headers can, in some cases, lead to nasty, nasty link times. On large projects, that can be sufficient reason to "hide" them behind a proprietary-looking API.

like image 22
kyoryu Avatar answered Nov 04 '22 07:11

kyoryu