35template<
class... Args>
43template<
class U,
class... Args>
111 if (ptr_)
delete ptr_;
122 reset(other.release());
139template<
class... Args>
144 return autoPtr<T>(ptr_->clone(std::forward<Args>(
args)...).ptr());
159 <<
"unallocated autoPtr of type " <<
typeid(
T).
name()
169 return const_cast<autoPtr<T>*
>(
this)->
operator*();
179 <<
"unallocated autoPtr of type " <<
typeid(
T).
name()
189 return const_cast<autoPtr<T>*
>(
this)->operator->();
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void swap(autoPtr< T > &other) noexcept
Swaps the managed object with other autoPtr.
T & operator*()
Return reference to the managed object.
T * operator->()
Dereferences (non-const) pointer to the managed object.
T & operator()()
Return reference to the object data.
T * release() noexcept
Release ownership and return the pointer.
void operator=(T *p)=delete
No copy assignment from plain pointer (uncontrolled access)
static autoPtr< T > NewFrom(Args &&... args)
Construct autoPtr from derived type with forwarding arguments.
constexpr autoPtr() noexcept
Construct with no managed pointer.
~autoPtr() noexcept
Deletes the managed pointer.
void reset()
Reset to defaults.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Foam::argList args(argc, argv)