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);
170 bool good() const noexcept {
return bool(ptr_); }
173 bool is_const() const noexcept {
return type_ == CREF; }
176 bool is_pointer() const noexcept {
return type_ == PTR; }
179 inline bool movable() const noexcept;
185 T*
get() noexcept {
return ptr_; }
188 const T*
get() const noexcept {
return ptr_; }
193 inline const T&
cref()
const;
198 inline T&
ref()
const;
209 inline T*
ptr()
const;
213 inline void clear() const noexcept;
217 inline
void reset(
tmp<
T>&& other) noexcept;
220 inline
void reset(
T*
p =
nullptr) noexcept;
224 inline
void cref(const
tmp<
T>& other) noexcept;
227 inline
void cref(const
T& obj) noexcept;
231 inline
void cref(const
T*
p) noexcept;
235 inline
void ref(
T& obj) noexcept;
239 inline
void ref(
T*
p) noexcept;
243 inline
void swap(
tmp<
T>& other) noexcept;
254 inline const
T* operator->() const;
258 inline
T* operator->();
261 const
T& operator()()
const {
return cref(); }
267 explicit operator bool() const noexcept {
return bool(ptr_); }
270 operator const T&()
const {
return cref(); }
287 inline void operator=(std::nullptr_t) noexcept;
293 bool valid() const noexcept {
return bool(ptr_); }
296 bool isTmp() const noexcept {
return type_ == PTR; }
302 bool empty() const noexcept {
return !ptr_; }
void operator=(const tmp< T > &other)
Transfer ownership of the managed pointer.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
A class for handling words, derived from Foam::string.
void clear() const noexcept
bool good() const noexcept
True if pointer/reference is non-null.
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.
bool is_const() const noexcept
If the stored/referenced content is const.
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.
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 reset(tmp< T > &&other) noexcept
Clear existing and transfer ownership.
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
Construct with no managed pointer.
bool valid() const noexcept
Identical to good(), or bool operator.
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)