I'm trying to understand how unique_ptr
works inside. I found a simple implementation. Please tell me what the constructor does.
template<typename T, typename D = default_delete<T>>
class unique_ptr {
public:
using pointer = T*;
using element_type = T;
using deleter_type = D;
unique_ptr(pointer p,
typename std::conditional<std::is_reference<deleter_type>::value,
deleter_type, const deleter_type&>::type d) noexcept
: _impl{p, d}
{ }
private:
detail::Ptr<T, D> _impl;