49 #ifndef Foam_autoPtr_H 50 #define Foam_autoPtr_H 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>
190 const T*
get()
const noexcept {
return ptr_; }
195 T&
ref() {
return *ptr_; }
228 template<class... Args>
236 inline
T& operator*();
240 inline const
T& operator*() const;
244 inline
T* operator->();
248 inline const
T* operator->() const;
252 inline
T& operator()();
256 inline const
T& operator()() const;
262 explicit operator
bool() const
noexcept {
return bool(ptr_); }
267 operator const T*()
const noexcept {
return ptr_; }
274 #ifdef Foam_autoPtr_castOperator 275 operator const T&()
const {
return operator*(); }
277 operator const T&()
const =
delete;
288 void operator=(
const autoPtr<T>&) =
delete;
298 reset(other.release());
302 void operator=(std::unique_ptr<T>&& other) {
reset(other.release()); }
324 #ifndef Foam_autoPtr_nodeprecate_setMethod T element_type
Type of object being managed.
void swap(autoPtr< T > &other) noexcept
Swaps the managed object with other autoPtr.
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 clear() noexcept
Same as reset(nullptr)
autoPtr(std::unique_ptr< T > &&rhs) noexcept
Move construct from unique_ptr, transferring ownership.
T * pointer
Pointer to type of object being managed.
~autoPtr() noexcept
Destructor: deletes managed pointer.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
constexpr autoPtr() noexcept
Construct with no managed pointer.
bool good() const noexcept
True if the managed pointer is non-null.
T * release() noexcept
Release ownership and return the pointer.
bool valid() const noexcept
Identical to good(), or bool operator.
autoPtr(autoPtr< T > &&rhs) noexcept
Move construct, transferring ownership.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
T & ref()
Return reference to the managed object without nullptr checking.
T * ptr() noexcept
Same as release().
autoPtr< T > clone(Args &&... args) const
Copy construct by invoking clone on underlying managed object.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
void operator=(T *p)=delete
No copy assignment from plain pointer (uncontrolled access)
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Foam::argList args(argc, argv)