Go to the documentation of this file.
50 #define Foam_autoPtr_copyConstruct
51 #define Foam_autoPtr_copyAssign
52 #define Foam_autoPtr_castOperator
91 template<
class... Args>
100 template<
class U,
class... Args>
107 inline constexpr
autoPtr() noexcept;
110 inline constexpr
autoPtr(std::nullptr_t) noexcept;
127 #ifdef Foam_autoPtr_copyConstruct
146 bool empty() const noexcept {
return !ptr_; }
149 bool valid() const noexcept {
return ptr_; }
156 T*
get() noexcept {
return ptr_; }
160 const T*
get() const noexcept {
return ptr_; }
165 T&
ref() {
return *ptr_; }
182 inline void reset(
T*
p =
nullptr) noexcept;
197 template<class... Args>
205 inline
T& operator*();
209 inline const
T& operator*() const;
213 inline
T* operator->();
217 inline const
T* operator->() const;
221 inline
T& operator()();
225 inline const
T& operator()() const;
232 #ifdef Foam_autoPtr_castOperator
233 operator const T&()
const {
return operator*(); }
235 operator const T&()
const =
delete;
239 operator const T*()
const noexcept {
return get(); }
242 operator T*() noexcept {
return get(); }
245 explicit operator bool() const noexcept {
return ptr_; }
254 #ifdef Foam_autoPtr_copyAssign
266 inline void operator=(std::nullptr_t) noexcept;
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
void swap(autoPtr< T > &other) noexcept
Swaps the managed object with other autoPtr.
T element_type
Type of object being managed.
T * pointer
Pointer to type of object being managed.
bool valid() const noexcept
True if the managed pointer is non-null.
void Swap(DynamicList< T, SizeMin1 > &a, DynamicList< T, SizeMin2 > &b)
T & operator*()
Return reference to the managed object.
bool empty() const noexcept
True if the managed pointer is null.
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
void set(T *p) noexcept
Deprecated(2018-02) Identical to reset().
~autoPtr() noexcept
Deletes the managed object if such is present.
T * release() noexcept
Return pointer to the managed object and release ownership.
T * get() noexcept
Return pointer to managed object without nullptr checking.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
T * ptr() noexcept
Same as release().
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void operator=(autoPtr< T > &&ap) noexcept
Transfer object ownership from parameter.
T & ref()
Return reference to the managed object without nullptr checking.
constexpr autoPtr() noexcept
Construct with no managed object.
void clear() noexcept
Same as reset(nullptr)
autoPtr(const autoPtr< T > &ap) noexcept
A move construct disguised as a copy construct (transfers ownership)
Foam::argList args(argc, argv)
autoPtr< T > clone(Args &&... args) const
Copy construct by invoking clone on underlying managed object.