//TODO: Use pointer traits of P to deduce `pointer_type`, so we can have P be a shared_ptr too. Or perhaps, a specialisation for `Cow<std::shared_ptr<T>>` would be better
//TODO: Use pointer traits of P to deduce `pointer_type`, so we can have P be a shared_ptr too. Or perhaps, a specialisation for `Cow<std::shared_ptr<T>>` would be better
},m_value))returnm_value.emplace<value_type>(*ct_from);//XXX: Do we need to create a temporary here for creating invariants by reading the old invariant?
//TODO: I don't think this works the way I want it to... We'll need to emplace inside this function I think, since the moved temporary has been moved. It might not matter though.
},std::move(m_value)))returnstd::move(m_value.emplace<value_type>(*ct_from));//XXX: Do we need to create a temporary here for creating invariants by reading the old invariant?
}
//These commented out visits modify the pointee of the borrowed invariant. THIS IS NOT WHAT WE WANT. Instead, we emplace a copy and then copy it again (possibly elided: &) or return it as an rvalue reference (elided: &&)
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,T&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,Tconst&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,T&&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,Tconst&&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?