okia reports that STL support
has been one of the most requested features among Symbian developers. This is no surprise. In 2006, using C++ without STL is like driving a car without wheels. Recently, Penrillian released uSTL, a free, low-memory footprint version of STL for Symbian OS. Is uSTL a dream come true or is it a far cry from the real thing?
ISO STLEssential but Elusive
Programmers using the Standard Library aren't always aware of the complex inner-workings that make it work so smoothly. A typical STL implementation consists of hundreds of functions and class templates that interact with each other through sophisticated iterators, type traits, and function objects. Additionally, STL relies on advanced template features that push state-of-the-art compilers and linkers to their limits. Since mobile operating systemsincluding the latest versions of Symbian and Windows Mobilesupport neither dynamic linking nor virtual memory management, porting ISO STL to these platforms is quite a challenge, to say the least. Developers have had to come to terms with this tough reality. Instead of using vector, string, and popular STL algorithms, they have to settle for makeshift container classes and watered down "algorithms" that try hard to impersonate those of STL. This state of affairs imposes significant limitations on the design of mobile applications. Yet considering the rigid limitations of mobile devices on the one hand, and the complex mesh of class templates, allocators, and algorithms that are needed for implementing STL, is there any hope for seeing something at least close to STL on contemporary mobile operating systems?
Mile Sharov decided to bite the bullet. By analyzing carefully the ISO C++ standard, he spotted out the impasses hindering the implementation of STL on mobile platforms. He acknowledged that full ISO compliance wouldn't be feasible. But he also realized that for the average C++ programmer, the low-level implementation details rarely matter. What users are looking for is the familiar interface of STL containers, algorithms, and iterators. He decided to implement an STL clone called uSTL (the "u" stands for the Greek letter mu, meaning "micro"). uSTL is a partial implementation of STL that replaces template-based memory management classes with a classic 1990's object-oriented design. Thus, instead of creating dozens of specializations from each template class, uSTL uses a simple inheritance model and virtual function overriding. The result is an odd beast: you immediately recognize the common look and feel of STL, but the underlying machinery is completely different.