61 template<
class T>
class refPtr;
84 mutable refType type_;
91 inline void incrCount();
118 inline explicit
tmp(
T*
p);
137 inline
tmp(const
tmp<
T>& rhs,
bool reuse);
163 template<class... Args>
175 template<
class U,
class... Args>
212 const T*
get()
const noexcept {
return ptr_; }
217 inline const T&
cref()
const;
222 inline T&
ref()
const;
233 inline T*
ptr()
const;
292 inline const
T* operator->() const;
296 inline
T* operator->();
299 const
T& operator()()
const {
return cref(); }
305 explicit operator bool() const
noexcept {
return bool(ptr_); }
308 operator const T&()
const {
return cref(); }
315 inline void operator=(
const tmp<T>& other);
350 void Swap(tmp<T>& lhs, tmp<T>& rhs)
bool isTmp() const noexcept
Identical to is_pointer()
static word typeName()
The type-name, constructed from type-name of T.
bool valid() const noexcept
Identical to good(), or bool operator.
Foam::refCount refCount
Reference counter class.
constexpr tmp() noexcept
Construct with no managed pointer.
Reference counter for various OpenFOAM components.
bool movable() const noexcept
True if this is a non-null managed pointer with a unique ref-count.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
bool empty() const noexcept
Deprecated(2020-07) True if a null managed pointer.
A class for managing references or pointers (no reference counting)
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
T * get() noexcept
Return pointer without nullptr checking.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
static tmp< T > NewFrom(Args &&... args)
Construct tmp from derived type with forwarding arguments.
void swap(tmp< T > &other) noexcept
Swaps the managed object with other.
bool is_reference() const noexcept
True if this is a reference (not a pointer)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
T * pointer
Pointer to type of object being managed or referenced.
void operator=(const tmp< T > &other)
Transfer ownership of the managed pointer.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference)
bool good() const noexcept
True if pointer/reference is non-null.
void clear() const noexcept
If object pointer points to valid object: delete object and set pointer to nullptr.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
T & constCast() const
Return non-const reference to the object or to the contents of a (non-null) managed pointer...
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
A class for managing temporary objects.
Foam::argList args(argc, argv)
bool is_const() const noexcept
If the stored/referenced content is const.
T element_type
Type of object being managed or referenced.
void reset(tmp< T > &&other) noexcept
Clear existing and transfer ownership.