Browse Source

Factory function updated and SFINAE typo fixed.

main
offa 7 years ago
parent
commit
4aa14a59b8
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      include/unique_resource.h

+ 2
- 2
include/unique_resource.h View File

return m_resource.get(); return m_resource.get();
} }


template<class RR = R, std::enable_if_t<std::is_pointer_v<RR>>
template<class RR = R, std::enable_if_t<std::is_pointer_v<RR>, int> = 0>
RR operator->() const noexcept RR operator->() const noexcept
{ {
return m_resource.get(); return m_resource.get();
&& std::is_nothrow_constructible_v<std::decay_t<D>, D>) && std::is_nothrow_constructible_v<std::decay_t<D>, D>)
{ {
const bool must_release{r == invalid}; const bool must_release{r == invalid};
auto ur = unique_resource{r, d};
unique_resource<std::decay_t<R>, std::decay_t<D>> ur{std::forward<R>(r), std::forward<D>(d)};


if( must_release == true ) if( must_release == true )
{ {

Loading…
Cancel
Save