Go to the documentation of this file.
35 template<
class... Args>
43 template<
class U,
class... Args>
111 if (ptr_)
delete ptr_;
134 template<
class... Args>
139 return autoPtr<T>(ptr_->clone(std::forward<Args>(
args)...).ptr());
154 <<
"unallocated autoPtr of type " <<
typeid(
T).
name()
164 return const_cast<autoPtr<T>*
>(
this)->
operator*();
174 <<
"unallocated autoPtr of type " <<
typeid(
T).
name()
184 return const_cast<autoPtr<T>*
>(
this)->operator->();
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 * operator->()
Dereferences (non-const) pointer to the managed object.
T & operator()()
Return reference to the object data.
T & operator*()
Return reference to the managed object.
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
~autoPtr() noexcept
Deletes the managed object if such is present.
word name(const complex &c)
Return string representation of complex.
T * release() noexcept
Return pointer to the managed object and release ownership.
errorManip< error > abort(error &err)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void operator=(autoPtr< T > &&ap) noexcept
Transfer object ownership from parameter.
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
constexpr autoPtr() noexcept
Construct with no managed object.
Foam::argList args(argc, argv)
autoPtr< T > clone(Args &&... args) const
Copy construct by invoking clone on underlying managed object.