/any

Implementation of std::experimental::any, including small object optimization, for C++11 compilers

Primary LanguageC++Boost Software License 1.0BSL-1.0

Any

This is a implementation of N4562. Drop-in replacement for std::any (C++17).

It contains configurable small object optimization. By default storing objects with a size of up to 3 words (such as int, float, std::shared_ptr, std::string) in the container will not trigger a dynamic allocation.

For a easy to understand documentation, see cppreference, except our namespace is nonstd.

Defines

You may additionally define the following preprocessor symbols (making the implementation non-standard):

  • ANY_IMPL_NO_EXCEPTIONS: This disables code paths that throw exceptions.
  • ANY_IMPL_NO_RTTI: This disables any::type(), thus removing all code paths using RTTI.