One question I get asked really often is why
Irrlicht is not using the
STL. I’m going to write a short answer here, and send people the link to this text in the future, or maybe even create a new FAQ entry on irrlicht.sf.net.
Irrlicht uses it's own template containers and does not rely on the STL, the C++ standard template library. In the
namespace core, you’ll find several useful templates which I implemented, for example a vector named
irr::core::array, a
list and a
string class. They are written in a way that you should know how they work, if you know how to use the STL, for example they have ::iterators and methods named like ::push_back or ::size(), ::clear(), etc. And they are really fast.
But why all the effort implementing those classes? Simply because Irrlicht is quite portable. Irrlicht compiles with 7 (or even more) different compilers and on 4 different platforms/operating systems, without a single warning. If I would have used the STL, it would have been a bit more difficult to achieve this, and to let Irrlicht keep its performance equally everywhere, because there are so many STL implementations, and all of them differ. Some of them even have bugs, for example the STL which comes with the latest VisualStudio has some known bugs. So I’ve simply a lot less problems by implementing these few simple classes and algorithms. There would have been the possibility to include a STL implementation like STLPort in Irrlicht, but as always, I wanted to reduce dependencies.
Ok, and honestly, another reason for implementing the containers was because I had fun doing that. And I think I did it quite well, the performance of the array is really good and has some really useful methods you don’t find in the STL, same for the string.
Also the containers are similiar to the STL counter parts, but not in all details, sometimes surprisingly different and with inconsistently named member function (push_back, but getLast). And eventhough they are similiar, they are still incompatible with STL algorithms, which tremendously reduces usability. Java is nice, there is a big standard lib and it is used and respected by almost all projects out there. Not so C++. Every C++ lib out there just *has to* define its own string class, which is never superior to std::basic_string. So, that when you use many libraries for a project at once your backend always contains pointless string conversions from one type to another.
No question: Your library, your choices. Nevertheless this is one of the design choices, I don't understand. Eventhough I can agree with many of your arguments (code readability) I still weight reasons pro STL higher.
The other design choice I don't really understand is that different file types have different interfaces (getXJointNode(), getMS3DJointNode()). If you have time and notion maybe you can explain this too in a blog entry please. I really love this kind of blog entries, as it helps to understand what makes a lib tick, what's the rationale behind it. :)