Contents
Introduction About STLport SGI STL Base STLport Story STLport Features Portability Debug Mode Thread Safety Exception Safety Getting Started Download and Install Select Streams Mode Compiling with STLport White Papers Release Notes READMEs Interface with std:: Wrappers Config manual Regression Test Exception Test Feedback Bug Reports Forum Appendix Acknowledgements Your Free Licence
| # Wrapper Technique in STLport Considerable point of non-portability was the lack of default template class parameters in many compilers. C++ template syntax doesn't allow an easy way to hide that behind any macro magic. STLport uses wrapper technique to work around that: Full functionality for 'container' is implemented via class '__container__'. For example:
    #ifdef __STL_DEFAULT_TYPE_PARAM
    template <class T, class Alloc = alloc>
    #else
    #  define vector __vector
    template <class T, class Alloc>
    #endif
    class vector {
    public:
    ......
    #ifdef __STL_DEFAULT_TYPE_PARAM
    define __vector__ vector
    # else
    template <class T>
    class vector : public __vector__<T,alloc>
    {
    .....
    #define __vector__ __vector
    # endif /* __STL_DEFAULT_TYPE_PARAM */
So, you are provided with two versions of container: with and without default parameters. It buys you a way to access full functionality while not breaking code using the short notation. If you wish to specify the allocator parameter, use `__vector__`. For default alloc parameter, use `vector`. I would recommend that you `#define` some alias for `__vector__`, to be able to switch easily. If you don't use different allocators, don't bother. New in STLport 3.2: `__STL_MINIMUM_DEFAULT_TEMPLATE_PARAMS` switch is introduced for user to take control of wrappers behavior with classes that have more than one default template argument. With this switch defined, STLport will use minimum set of default arguments on template classes that have more than one - for example map<>, set<>. This is supposed to help compiling existing standard code which use shortest notation. Here is the list of compilers that cannot handle dependant default template parameters: SunPro CC, BC++ 4.52, VC++ 4.2, xlC 3.1.4, DEC C++ 5.5, Visual Age C++ 3.0.