util::unique_any: a non-copyable util::any (#257)
Add a non-copyable variant of `util::any`. The two main use cases for such a container are: 1. Storing types that are not copyable. 2. Ensuring that no copies are made of copyable types that have to be stored in a type-erased container. `unique_any` has the same semantics as `any` with the exception of copy construction and copy assignment, which are explicitly forbidden. The requirement that the contained type be copy-constructable has also been relaxed. The `any_cast` non-member functions have been overridden for `unique_any`, with the same semantics as for `any`.
Showing
- src/util/any.hpp 4 additions, 18 deletionssrc/util/any.hpp
- src/util/unique_any.hpp 211 additions, 0 deletionssrc/util/unique_any.hpp
- tests/unit/CMakeLists.txt 1 addition, 0 deletionstests/unit/CMakeLists.txt
- tests/unit/test_any.cpp 34 additions, 17 deletionstests/unit/test_any.cpp
- tests/unit/test_unique_any.cpp 433 additions, 0 deletionstests/unit/test_unique_any.cpp
Please register or sign in to comment