Lumiera  0.pre.03
»edit your freedom«
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
several.hpp File Reference

Go to the source code of this file.

Description

Abstraction interface: array-like random access by subscript.

Design

This is a data structure abstraction suitable for performance critical code. It is used pervasively in the backbone of the Lumiera »Render Node Network«.

  • usage is clear and concise, allowing to hide implementation details
  • adaption and optimisation for various usage patterns is possible
  • suitably fast read access with a limited amount of indirections
    why not std::vector?
    The most prevalent STL container almost fulfils the above mentioned criteria, and thus served as a blueprint for design and implementations. Some drawbacks however prevent its direct use for this purpose. Notably, std::vector leaks implementation details of the contained data and generally exposes way too much operations; it is not possible to abstract away the concrete element type. Moreover, using vector with a custom allocator is surprisingly complicated, requires to embody the concrete allocator type into the container type and requires to store an additional back-link whenever the allocator is not a monostate. The intended use case calls for a large number of small collection elements, which are repeatedly bulk- allocated and deallocated.
    The lib::Several container is a smart front-end and exposes array-style random access through references to a interface type. It can only be created and populated through a builder, and is immutable during lifetime, while it can hold non-const element data. The actual implementation data types and the employed allocator framework are not exposed in the front-end's type signature. The container is single-ownership (move-asignable); some additional metadata and the data storage reside within an ArrayBucket<I>, managed by the allocator. In its simplest form, this storage is heap allocated and automatically deleted.
    See also
    several-builder.hpp

Definition in file several.hpp.

#include "lib/nocopy.hpp"
#include "lib/index-iter.hpp"
#include <cstddef>
#include <functional>

Classes

struct  ArrayBucket< I >
 Metadata record placed immediately before the data storage. More...
 
class  SelfDestructor< TAR >
 
class  Several< I >
 Abstraction: Fixed array of elements. More...
 

Namespaces

 lib
 Implementation namespace for support and library code.