uSTL Documentation


uSTL is a partial implementation of the STL specification intended to reduce code size of the derivative programs. Usually, the STL containers manage their own storage with new[] and delete[] operators, which create strongly typed storage. That is the standard way of allocating C++ object vectors, allowing appropriate constructors and destructors to be called on the allocated storage and ensuring that objects are copied via their copy operators. Although type safety is a good thing, placing memory management code into a template necessitates its reinstantiation for every template instance used by the derivative program. This produces substantial code bloat, that is frequently derided by C developers and used by them as an argument that C is better than C++. The uSTL implementation solves this problem by factoring memory management code into a non-template base class, ustl::memblock, which performs unstructured memory allocation. STL containers are then implemented as template wrappers for memblock to provide a measure of type safety. The result is that each template instantiation contains less code, and although it does not completely "disappear", due to the requirement for calling placement constructors on the allocated memory, most of it does, being replaced by calls to memblock methods. The base classes for unstructured storage management (cmemlink - link to constant memory, memlink - link to mutable memory, and memblock - owner of mutable memory) are, of course, also available for use as data buffers wherever those are needed, and streams that efficiently read and write binary data into them are also available.

Generated on Mon Sep 28 2015 17:58:50 for uSTL by Doxygen 1.8.10