...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::scope::unallocated_resource — Simple resource traits for one or more unallocated resource values.
// In header: <boost/scope/unique_resource.hpp> template<auto DefaultValue, auto... UnallocatedValues> struct unallocated_resource { // public static functions static decltype(DefaultValue) make_default() noexcept; template<typename Resource> static bool is_allocated(Resource const &) noexcept; };
This class template generates resource traits for unique_resource
that specify one or more unallocated resource values. The first value, specified in the DefaultValue
non-type template parameter, is considered the default. The other values, listed in UnallocatedValues
, are optional. Any resource values other than DefaultValue
or listed in UnallocatedValues
are considered as allocated.
In order for the generated resource traits to enable optimized implementation of unique_resource
, the resource type must support non-throwing construction and assignment from, and comparison for (in)equality with DefaultValue
or any of the resource values listed in UnallocatedValues
.