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

Function template make_unique_resource_checked

boost::scope::make_unique_resource_checked — Checks if the resource is valid and creates a unique_resource wrapper.

Synopsis

// In header: <boost/scope/unique_resource.hpp>


template<typename Resource, typename Deleter, 
         typename Invalid = typename std::decay< Resource >::type> 
  unique_resource< typename std::decay< Resource >::type, typename std::decay< Deleter >::type > 
  make_unique_resource_checked(Resource && res, Invalid const & invalid, 
                               Deleter && del);

Description

Effects: If the resource res is not equal to invalid, creates a unique resource wrapper that is in allocated state and owns res. Otherwise creates a unique resource wrapper in unallocated state.

[Note] Note

This function does not call del if res is equal to invalid.

Throws: Nothing, unless unique_resource constructor throws.

Parameters:

del

A deleter to invoke on the resource to free it.

invalid

An invalid value for the resource.

res

Resource to wrap.


PrevUpHomeNext