Go to the documentation of this file.
81 mutable refType type_;
88 inline void incrCount();
114 template<
class... Args>
122 template<
class U,
class... Args>
129 inline constexpr
tmp() noexcept;
132 inline constexpr
tmp(std::nullptr_t) noexcept;
135 inline explicit
tmp(
T*
p);
138 inline constexpr
tmp(const
T& obj) noexcept;
142 inline
tmp(
tmp<
T>&& rhs) noexcept;
147 inline
tmp(const
tmp<
T>&& rhs) noexcept;
154 inline
tmp(const
tmp<
T>& rhs,
bool reuse);
173 bool empty() const noexcept {
return !ptr_; }
176 bool valid() const noexcept {
return ptr_; }
179 bool is_pointer() const noexcept {
return type_ == PTR; }
182 bool isTmp() const noexcept {
return type_ == PTR; }
185 inline bool movable() const noexcept;
191 T*
get() noexcept {
return ptr_; }
194 const T*
get() const noexcept {
return ptr_; }
199 inline const T&
cref()
const;
204 inline T&
ref()
const;
215 inline T*
ptr()
const;
219 inline void clear() const noexcept;
222 inline
void reset(
T*
p =
nullptr) noexcept;
225 inline
void reset(
tmp<
T>&& other) noexcept;
228 inline
void cref(const
T& obj) noexcept;
231 inline
void ref(
T& obj) noexcept;
234 inline
void swap(
tmp<
T>& other) noexcept;
241 inline const
T* operator->() const;
245 inline
T* operator->();
248 const
T& operator()()
const {
return cref(); }
251 operator const T&()
const {
return cref(); }
254 explicit operator bool() const noexcept {
return ptr_; }
268 inline void operator=(std::nullptr_t) noexcept;
void operator=(const tmp< T > &other)
Transfer ownership of the managed pointer.
A class for handling words, derived from Foam::string.
void clear() const noexcept
A class for managing temporary objects.
Reference counter for various OpenFOAM components.
bool empty() const noexcept
Deprecated(2020-07) True if a null managed pointer.
T element_type
Type of object being managed or referenced.
const T * get() const noexcept
Return const pointer without nullptr checking.
bool isTmp() const noexcept
Identical to is_pointer()
static tmp< T > NewFrom(Args &&... args)
Construct tmp from derived type with forwarding arguments.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
T * get() noexcept
Return pointer without nullptr checking.
static word typeName()
The type-name, constructed from type-name of T.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
T * pointer
Pointer to type of object being managed or referenced.
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
void swap(tmp< T > &other) noexcept
Swaps the managed object with other.
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
constexpr tmp() noexcept
Default construct, no managed pointer.
bool valid() const noexcept
True for non-null pointer/reference.
void reset(T *p=nullptr) noexcept
Delete managed temporary object and set to new given pointer.
Foam::argList args(argc, argv)
Foam::refCount refCount
Reference counter class.
bool movable() const noexcept
True if this is a non-null managed pointer with a unique ref-count.
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference)