11#ifndef STX_UNIQUE_CAST_HPP_INCLUDED
12#define STX_UNIQUE_CAST_HPP_INCLUDED
20template <
typename T,
typename... Args>
21std::unique_ptr<T> make_unique(Args &&... args) {
22 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
28template <
typename Derived,
typename Base>
30 auto d =
static_cast<Derived *
>(p.release());
31 return std::unique_ptr<Derived>(d);
37template <
typename Derived,
typename Base>
39 auto d =
dynamic_cast<Derived *
>(p.get());
42 return std::unique_ptr<Derived>(d);
std::unique_ptr< Derived > static_unique_ptr_cast(std::unique_ptr< Base > &&p) noexcept
A cast for unique pointers, used to downcast to a derived type iff we're certain the cell is indeed o...
Definition: CellPtr.h:657
std::unique_ptr< Derived > dynamic_unique_ptr_cast(std::unique_ptr< Base > &&p) noexcept
A cast for unique pointers, used to downcast to a derived type in a type-safe manner.
Definition: CellPtr.h:667