Go to the documentation of this file.
50 #define Foam_autoPtr_copyConstruct
51 #define Foam_autoPtr_castOperator
91 template<
class... Args>
100 template<
class U,
class... Args>
107 inline constexpr
autoPtr() noexcept;
110 inline constexpr
autoPtr(std::nullptr_t) noexcept;
127 #ifdef Foam_autoPtr_copyConstruct
149 bool empty() const noexcept {
return !ptr_; }
152 bool valid() const noexcept {
return ptr_; }
159 T*
get() noexcept {
return ptr_; }
163 const T*
get() const noexcept {
return ptr_; }
168 T&
ref() {
return *ptr_; }
185 inline void reset(
T*
p =
nullptr) noexcept;
200 template<class... Args>
208 inline
T& operator*();
212 inline const
T& operator*() const;
216 inline
T* operator->();
220 inline const
T* operator->() const;
224 inline
T& operator()();
228 inline const
T& operator()() const;
234 explicit operator
bool() const noexcept {
return bool(ptr_); }
237 operator const T*()
const noexcept {
return ptr_; }
240 operator T*() noexcept {
return ptr_; }
247 #ifdef Foam_autoPtr_castOperator
248 operator const T&()
const {
return operator*(); }
250 operator const T&()
const =
delete;
268 inline void operator=(std::nullptr_t) noexcept;
278 #ifdef Foam_autoPtr_deprecate_setMethod
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
void swap(autoPtr< T > &other) noexcept
Swaps the managed object with other autoPtr.
T element_type
Type of object being managed.
T * pointer
Pointer to type of object being managed.
bool valid() const noexcept
True if the managed pointer is non-null.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
T & operator*()
Return reference to the managed object.
bool empty() const noexcept
Deprecated(2020-07) True if the managed pointer is null.
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
void set(T *p) noexcept
Deprecated(2018-02) Identical to reset().
~autoPtr() noexcept
Deletes the managed object if such is present.
T * release() noexcept
Return pointer to the managed object and release ownership.
T * get() noexcept
Return pointer to managed object without nullptr checking.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
T * ptr() noexcept
Same as release().
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void operator=(autoPtr< T > &&ap) noexcept
Transfer object ownership from parameter.
#define Foam_autoPtr_castOperator
T & ref()
Return reference to the managed object without nullptr checking.
constexpr autoPtr() noexcept
Construct with no managed object.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
void clear() noexcept
Same as reset(nullptr)
autoPtr(const autoPtr< T > &ap) noexcept
A move construct disguised as a copy construct (transfers ownership)
Foam::argList args(argc, argv)
autoPtr< T > clone(Args &&... args) const
Copy construct by invoking clone on underlying managed object.