Checks if the resource is valid and creates a unique_resource wrapper.

Synopsis

template<
    typename Resource,
    typename Deleter,
    typename Invalid = decay<Resource>::type>
unique_resource<decay<Resource>::type, decay<Deleter>::type>
make_unique_resource_checked(
    Resource&& res,
    const Invalid& invalid,
    Deleter&& del) noexcept(detail::conjunction<std::is_nothrow_constructible<typename std::decay<Resource>::type, typename detail::move_or_copy_construct_ref<Resource, typename std::decay<Resource>::type>::type>, std::is_nothrow_constructible<typename std::decay<Deleter>::type, typename detail::move_or_copy_construct_ref<Deleter, typename std::decay<Deleter>::type>::type>>::value);

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 deallocated state.

Note
This function does not call del if res is equal to invalid. Throws: Nothing, unless unique_resource constructor throws.

Return Value

Parameters

Name Type

res

Resource&&

invalid

const Invalid&

del

Deleter&&