BLI: add conversion constructor for destruct_ptr
This allows converting between different `destruct_ptr` types (which is just a `std::unique_ptr` with a custom deleter). The most common use case is to convert from a derived type to the type of the base class.
This commit is contained in:
parent
dc3f46d96b
commit
ded4dc7761
|
@ -309,6 +309,12 @@ template<typename T> void uninitialized_fill_n(T *dst, int64_t n, const T &value
|
|||
}
|
||||
|
||||
template<typename T> struct DestructValueAtAddress {
|
||||
DestructValueAtAddress() = default;
|
||||
|
||||
template<typename U> DestructValueAtAddress(const U &)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(T *ptr)
|
||||
{
|
||||
ptr->~T();
|
||||
|
|
Loading…
Reference in New Issue