Skip to content

Memory management: cast functions for managed pointers

Marc Chevrier requested to merge marc.chevrier/cmake:misc into master

Following up the discussion C++ standard library extensions, here is the first MR applying these definitions:

The cmext/memory introduce helper functions to cast from managed types (like std::unique_ptr). These functions use same approach than the helper functions provided by <memory> (std::static_pointer_cast, etc...).

Moreover, I introduce some meta-programming for two reasons:

  1. To ensure the compiler will not try to instantiate the template with an invalid argument.
  2. To Increase flexibility: Any pointer wrapper offering method get() returning the managed pointer can be used to instantiate the template.

To use efficiently the meta-programming, I introduce also file cm/type_traits.

Topic-rename: cmext-memory

Edited by Brad King

Merge request reports