53#define Foam_autoPtr_copyConstruct
54#define Foam_autoPtr_castOperator
130 #ifdef Foam_autoPtr_copyConstruct
155 template<
class... Args>
167 template<
class U,
class... Args>
195 T&
ref() {
return *ptr_; }
221 template<class... Args>
233 template<class... Args>
241 inline
T& operator*();
245 inline const
T& operator*() const;
249 inline
T* operator->();
253 inline const
T* operator->() const;
257 inline
T& operator()();
261 inline const
T& operator()() const;
267 explicit operator
bool() const
noexcept {
return bool(ptr_); }
272 operator const T*()
const noexcept {
return ptr_; }
279 #ifdef Foam_autoPtr_castOperator
280 operator const T&()
const {
return operator*(); }
282 operator const T&()
const =
delete;
303 reset(other.release());
307 void operator=(std::unique_ptr<T>&& other) {
reset(other.release()); }
329 #ifndef Foam_autoPtr_nodeprecate_setMethod
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void operator=(std::nullptr_t) noexcept
Reset via assignment from literal nullptr.
void clear() noexcept
Same as reset(nullptr).
Function1 & emplace(Args &&... args)
void operator=(std::unique_ptr< T > &&other)
Transfer ownership by move assignment from unique_ptr.
void operator=(autoPtr< U > &&other) noexcept
Transfer object ownership from parameter.
autoPtr(const autoPtr< T > &rhs) noexcept
A move construct disguised as a copy construct (transfers ownership).
constexpr autoPtr(std::nullptr_t) noexcept
Implicit construct from literal nullptr: no managed pointer.
T & ref()
Return reference to the managed object without nullptr checking.
void swap(autoPtr< Function1 > &other) noexcept
T & operator*()
Return reference to the managed object.
bool empty() const noexcept
T * get() noexcept
Return pointer to managed object without nullptr checking.
bool good() const noexcept
True if the managed pointer is non-null.
T * pointer
Pointer to type of object being managed.
const T * get() const noexcept
Return const pointer to managed object without nullptr checking.
Function1 * release() noexcept
void operator=(T *p)=delete
No copy assignment from plain pointer (uncontrolled access).
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
constexpr autoPtr() noexcept
Construct with no managed pointer.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
bool valid() const noexcept
Identical to good(), or bool operator.
autoPtr< Function1 > clone(Args &&... args) const
autoPtr(T *p) noexcept
Construct, taking ownership of the pointer.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
autoPtr(std::unique_ptr< T > &&rhs) noexcept
Move construct from unique_ptr, transferring ownership.
Function1 * ptr() noexcept
void operator=(const autoPtr< T > &)=delete
No move assignment disguised as a copy assignment.
void set(T *p) noexcept
Deprecated(2018-02) Identical to reset().
T element_type
Type of object being managed.
void operator=(autoPtr< T > &&other) noexcept
Transfer object ownership from parameter.
~autoPtr() noexcept
Destructor: deletes managed pointer.
autoPtr(autoPtr< U > &&rhs)
Move construct, transferring ownership from derived type.
autoPtr(autoPtr< T > &&rhs) noexcept
Move construct, transferring ownership.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Foam::argList args(argc, argv)
Includes some common C++ headers, defines global macros and templates used in multiple places by Open...
#define FOAM_DEPRECATED_FOR(since, replacement)