Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Struct template unallocated_resource

boost::scope::unallocated_resource — Simple resource traits for one or more unallocated resource values.

Synopsis

// 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;
};

Description

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.

unallocated_resource public static functions

  1. static decltype(DefaultValue) make_default() noexcept;
    Returns the default resource value.
  2. template<typename Resource> 
      static bool is_allocated(Resource const & res) noexcept;
    Tests if res is an allocated resource value.

PrevUpHomeNext