Go to the documentation of this file.
4 #ifndef DUNE_TO_UNIQUE_PTR_HH
5 #define DUNE_TO_UNIQUE_PTR_HH
36 :
public std::unique_ptr<T>
38 using Super = std::unique_ptr<T>;
71 DUNE_DEPRECATED_MSG(
"Cast to raw pointer is deprecated. Use std::unique_ptr or std::shared_ptr instead.")
72 operator
pointer() noexcept {
return Super::release(); }
75 operator std::unique_ptr<T>() noexcept {
return std::move(
static_cast<Super&
>(*
this)); }
78 operator std::shared_ptr<T>() noexcept {
return std::move(
static_cast<Super&
>(*
this)); }
81 explicit operator bool() noexcept {
return bool(
static_cast<Super&
>(*
this)); }
84 explicit operator bool() const noexcept {
return bool(
static_cast<Super const&
>(*
this)); }
91 template <
class T,
class... Args>
94 return {
new T(std::forward<Args>(args)...)};
99 #endif // DUNE_TO_UNIQUE_PTR_HH
ToUniquePtr(std::nullptr_t) noexcept
Constructor, creates a nullptr
Definition: to_unique_ptr.hh:59
DUNE_DEPRECATED_MSG("Cast to raw pointer is deprecated. Use std::unique_ptr or std::shared_ptr instead.") operator pointer() noexcept
Convert to underlying pointer, releases the stored pointer. NOTE: deprecated.
Definition: to_unique_ptr.hh:71
typename Super::pointer pointer
Definition: to_unique_ptr.hh:44
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
ToUniquePtr< T > makeToUnique(Args &&... args)
Constructs an object of type T and wraps it in a ToUniquePtr,.
Definition: to_unique_ptr.hh:92
An owning pointer wrapper that can be assigned to (smart) pointers. Cannot be copied....
Definition: to_unique_ptr.hh:35
ToUniquePtr(pointer ptr=pointer()) noexcept
Constructor, stores the pointer.
Definition: to_unique_ptr.hh:54
Dune namespace.
Definition: alignedallocator.hh:13