3 authors Storage types fixed (#32)
2746584 May 28, 2022
Storage types fixed (#32)
* - removed void_ptr. The storage types handle the underlying pointers manually. This deals with local storage (future SBO and other) properly
- All storages define copy semantics AND move semantics. If the underlying (erased) type is not copy constructible, then an exception is thrown at runtime if a copy is attempted. Similar thing for move semantics.
- defined custom exchange() as std::exchange() is not constexpr in C++17

* - removed the test on void_ptr as it no longer exists

* - constructors are conditionally noexcept if and only if underlying type is nothrow constructible with forwarding reference
- added small buffer optimization (SBO) storage

* - keeping codacity happy

* - added shared_storage

* - make all storages default constructible. This will be required if we want te::poly to be default constructible in the future. No reason why not.
- bug: If a copy assign or move assign throws, the pointer won't be reset so you could get a double free.
  fix: null pointers after deletion
- added tests for sbo_storage and shared_storage

* - added should_support_ref_storage(). This is important
- enhancing should_support_dynamic_storage()

* - make sure the forwarding reference isn't a storage type
- testing value semantics more thoroughly based on storage type

* - probs best to split the constructors rather than use if constexpr()

* - test for self-assignment

* - noexcept correctness

* - noexcept correctness

* - tyring to correct noexcept specifier while keeping Codacy happy

* - added noexcept specifiers for copy and move semantics

* - make it always noexcept to make Codacy happy. I'm 100% sure this is not correct but let's make Github happy

* - fighting Codacy

* - fighting Codacy : maybe it's because we have to use the decayed type??

* - wondering if re-adding default empty constructors will make Codacy happy
- function pointers for copy, move etc need to have arguments with correct names, i.e. whether the pointers refer to 'self' or 'other' objects

* - added explicit constructors where I can
- removed default constructors. I re-added them at some point because I thought that would somehow trigger some C++ rule that would make Codacy happy
- added // cppcheck-suppress noExplicitConstructor to one of the poly constructors

* move the cppcheck comment

* use add_compile_options instead of changing global variable CMAKE_CXX_FLAGS

* - build with g++-8, g++-9 and g++-10

* Revert "- build with g++-8, g++-9 and g++-10"

This reverts commit cd872c1.

Co-authored-by: pf <pf@me>
Co-authored-by: pfeatherstone <peter@me>
2746584