项目作者: libjv

项目描述 :
Type abstractor for polymorphic hierarchies.
高级语言: C++
项目地址: git://github.com/libjv/BoundedPoly.git
创建时间: 2020-06-30T09:18:13Z
项目社区:https://github.com/libjv/BoundedPoly

开源协议:Boost Software License 1.0

下载


BoundedPoly

BoundedPoly<Storage, Base, Mover = ...> is a type abstractor for C++17.
It stores any no-throw movable polymorphic derived class of Base that fits into size and alignment of Storage.
It provides semantics similar to std::unique_ptr<Base> and std::variant<...>:

  • The memory is owned by the instance (like both, and unlike std::reference_wrapper<Base>).
  • The type can change over time (like both).
  • The actual type of the stored value is not known (like unique_ptr).
  • The set of accepted types is not closed (line unique_ptr and unline variant).
  • It is allocated on the stack (like variant).
  • It cannot be empty, even when exceptions are thrown (like variant, but greater guarantee).

This allows to use both polymorphic-semantics and stack-allocation (and so, cache-friendlyness).

More details

  • index.html to see examples, benchmarks results and motivations for this library.
  • reference.html to see the documentation reference.

Build

Compilation

This project uses CMake, which must be installed on your machine.

  1. Create a sub-directory named build and open a console there.
  2. Make cmake .. to create the project files.
  3. Make cmake --build . to compile the project.

There are now 5 executables:

  • ŧests/tests which executes the tests.
  • examples/shape which executes the example.
  • examples/benchmark/* which are the three executables used for the benchmark.

Documentation

The documentation is compiled with Asciidoctor, which must be installed on your machine.
Then open a console in the root directory, and run:

  1. asciidoctor -B . -R docs-src -D docs 'docs-src/**/*.adoc'