Skip to content
/ any Public
forked from thelink2012/any

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

License

Notifications You must be signed in to change notification settings

trueqbit/any

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Any

This is a implementation of N4562 std::experimental::any (merged into C++17) for C++11 compilers.

It contains a small object optimization for objects with a size of up to 2 words (such as int, float and std::shared_ptr). Storing those objects in the container will not trigger a dynamic allocation.

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

Defines

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

  • ANY_IMPL_ANY_CAST_MOVEABLE: This implements a fix proposed in LWG Defect 2509. This will cause the expressions T x = any_cast<T>(any(T())) and T x = any_cast<T&&>(any(T()))to perform a move into x instead of a copy.
  • ANY_IMPL_FAST_TYPE_INFO_COMPARE: When checking if two typeid are the same, performs just a pointer comparision instead of the actual type_info::operator== comparision. Be aware this isn't recommended unless you know what you're doing.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.1%
  • CMake 0.9%