|
cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Backports related to Standard Header <memory>
Interfaces defined here:
alignof() (C++11) (See base_features ).addressof() (C++11) - get the memory address of an object.aligned_storage (C++11) - create an unitialized buffer for storing an object of a given type.std::default_delete (C++11).unique_ptr emulation (C++11) - smart pointer that owns and holds a resource. make_unique() (C++14) - assist for creating unique_ptr .destroy() , destroy_at() (C++17) - memory management by calling destructors.make_shared() - construct shared smart pointers safely (for some C++03 compilers).Interfaces repointed here when found in TR1:
std::shared_ptr and related utilities.std::weak_ptr and related utilities.std::default_delete std::make_shared .Non-backport interfaces (cxxomfort::fix):
to_bool() overloads to quickly check validity of a smart pointer: see Smart Pointer accessors .cxxomfort::fix::malloc_deleter - function object deleter that wrapps free() .cxxomfort provides, for the available smart pointer types, the special function cxxomfort::fix::to_bool() which takes as argument a smart pointer type and returns if it currently manages a value, as if checking their (C++>=11) operator bool property.
Functionally, invoking these accessors is a simpler means to checking the managed status than using eg.: explicit_cast<bool>(...), and it has the advantage of working in C++03 and C++11/14 pre the new "@c if condition declaration" rule as well:
__alignof(T).std::shared_ptr to exist and work in order, as part of the general TR1 requirement.aligned_storage<S,A> may not deliver a type with correct alignment when the template argument A is ommitted (in which case, a likely result is a type aligned to sizeof(int)). aligned_storage<sizeof(T),alignof(T)>.
1.8.13