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
146 bool good() const noexcept {
return bool(ptr_); }
153 T*
get() noexcept {
return ptr_; }
157 const T*
get() const noexcept {
return ptr_; }
162 T&
ref() {
return *ptr_; }
185 inline void reset(
T*
p =
nullptr) noexcept;
196 template<class... Args>
204 inline
T& operator*();
208 inline const
T& operator*() const;
212 inline
T* operator->();
216 inline const
T* operator->() const;
220 inline
T& operator()();
224 inline const
T& operator()() const;
230 explicit operator
bool() const noexcept {
return bool(ptr_); }
233 operator const T*()
const noexcept {
return ptr_; }
236 operator T*() noexcept {
return ptr_; }
243 #ifdef Foam_autoPtr_castOperator
244 operator const T&()
const {
return operator*(); }
246 operator const T&()
const =
delete;
267 inline void operator=(std::nullptr_t) noexcept;
273 bool valid() const noexcept {
return bool(ptr_); }
279 bool empty() const noexcept {
return !ptr_; }
286 #ifdef Foam_autoPtr_deprecate_setMethod
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
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
Identical to good(), or bool operator.
T & operator*()
Return reference to the managed object.
void operator=(T *p)=delete
No copy assignment from plain pointer (uncontrolled access)
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 pointer.
T * release() noexcept
Release ownership and return the pointer.
T * get() noexcept
Return pointer to managed object without nullptr checking.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
bool good() const noexcept
True if the managed pointer is non-null.
T * ptr() noexcept
Same as release().
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
#define Foam_autoPtr_castOperator
T & ref()
Return reference to the managed object without nullptr checking.
constexpr autoPtr() noexcept
Construct with no managed pointer.
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.