:relfileprefix: ../../
[#084E950EEBC3F5B62CFCCB163A4EB1A779F3A9A3]

= Function make_unique_resource_checked

pass:v,q[Checks if the resource is valid and creates a] `unique_resource` pass:v,q[wrapper.]


== Synopsis

Declared in header `<https://github.com/Lastique/scope/blob/develop/include/boost/scope/unique_resource_fwd.hpp#L34[boost/scope/unique_resource_fwd.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<
    typename Resource,
    typename Deleter,
    typename Invalid = decay<Resource>::type>
xref:boost/scope/unique_resource-0c.adoc[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

pass:v,q[**Effects:** If the resource] _res_ pass:v,q[is not equal to] _invalid,_
pass:v,q[creates a unique resource wrapper]
pass:v,q[that is in allocated state and owns]
_res._
pass:v,q[Otherwise creates a unique resource wrapper]
pass:v,q[in deallocated state.]
[NOTE]
pass:v,q[This function does not call]
_del_
pass:v,q[if]
_res_
pass:v,q[is equal to]
_invalid._
pass:v,q[**Throws:** Nothing, unless]
`unique_resource`
pass:v,q[constructor throws.]



== Return Value

* `xref:boost/scope/unique_resource-0c.adoc[unique_resource]<decay<Resource>::type, decay<Deleter>::type>` 


== Parameters

|===
| Name | Type 

| *res*
| `Resource&&`

| *invalid*
| `const Invalid&`

| *del*
| `Deleter&&`

|===



