74 mutable refType type_;
100 template<
class... Args>
108 template<
class U,
class... Args>
178 inline const T&
cref()
const;
183 inline T&
ref()
const;
204 inline
T*
ptr() const;
221 void reset(std::unique_ptr<T>&& other) {
reset(other.release()); }
228 inline void cref(
const T& obj)
noexcept;
232 inline void cref(
const T*
p)
noexcept;
236 inline void ref(
T& obj)
noexcept;
240 inline void ref(
T*
p)
noexcept;
275 operator const T&()
const {
return cref(); }
292 inline void operator=(std::nullptr_t)
noexcept;
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A class for managing references or pointers (no reference counting)
constexpr refPtr() noexcept
Construct with no managed pointer.
Foam::refCount::zero refCount
Null reference counter class.
bool is_pointer() const noexcept
True if this is a managed pointer (not a reference)
static word typeName()
The type-name, constructed from type-name of T.
const T & operator*() const
Return const reference to the object.
bool empty() const noexcept
Deprecated(2020-07) True if a null managed pointer.
T * get() noexcept
Return pointer without nullptr checking.
bool good() const noexcept
True if pointer/reference is non-null.
void swap(refPtr< T > &other) noexcept
Swaps the managed object with other.
T * pointer
Pointer to type of object being managed or referenced.
const T * get() const noexcept
Return const pointer without nullptr checking.
void clear() const noexcept
bool movable() const noexcept
True if this is a non-null managed pointer.
bool valid() const noexcept
Identical to good(), or bool operator.
void reset(std::unique_ptr< T > &&other)
Clear existing and transfer ownership from unique_ptr.
void reset(autoPtr< T > &&other) noexcept
Clear existing and transfer ownership from autoPtr.
void reset(refPtr< T > &&other) noexcept
Clear existing and transfer ownership.
const T * operator->() const
Dereferences (const) pointer to the managed object.
bool is_const() const noexcept
If the stored/referenced content is const.
T * ptr() const
Return managed pointer for reuse, or clone() the object reference.
static refPtr< T > NewFrom(Args &&... args)
Construct refPtr from derived type with forwarding arguments.
T element_type
Type of object being managed or referenced.
refPtr< T > shallowClone() const noexcept
void operator=(const refPtr< T > &other)
Transfer ownership of the managed pointer.
static refPtr< T > New(Args &&... args)
Construct refPtr of T with forwarding arguments.
const T & operator()() const
Return const reference to the object - same as cref() method.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
Foam::argList args(argc, argv)
#define FOAM_DEPRECATED_FOR(since, replacement)
A non-counting (dummy) refCount.