STYLE: use nullptr instead of 0 in autoPtr, tmp etc.
This commit is contained in:
parent
b287d1bddd
commit
2fe3a62057
@ -73,7 +73,7 @@ Foam::functionObject* Foam::functionObjectList::remove
|
||||
label& oldIndex
|
||||
)
|
||||
{
|
||||
functionObject* ptr = 0;
|
||||
functionObject* ptr = nullptr;
|
||||
|
||||
// Find index of existing functionObject
|
||||
HashTable<label>::iterator fnd = indices_.find(key);
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
|
||||
//- Store object pointer and manage its deletion
|
||||
// Can also be used later to transfer by assignment
|
||||
inline explicit Xfer(T* p = 0);
|
||||
inline explicit Xfer(T* p = nullptr);
|
||||
|
||||
//- Construct by copying or by transferring the parameter contents
|
||||
inline explicit Xfer(T& t, bool allowTransfer=false);
|
||||
@ -144,20 +144,20 @@ public:
|
||||
//
|
||||
// \sa xferCopyTo, xferMove, xferMoveTo, xferTmp and Foam::Xfer
|
||||
template<class T>
|
||||
inline Xfer<T> xferCopy(const T&);
|
||||
inline Xfer<T> xferCopy(const T& t);
|
||||
|
||||
//- Construct by transferring the contents of the \a arg
|
||||
//
|
||||
// \sa xferCopy, xferCopyTo, xferMoveTo, xferTmp and Foam::Xfer
|
||||
template<class T>
|
||||
inline Xfer<T> xferMove(T&);
|
||||
inline Xfer<T> xferMove(T& t);
|
||||
|
||||
|
||||
//- Construct by transferring the contents of the \a arg
|
||||
//
|
||||
// \sa xferCopy, xferCopyTo, xferMove, xferMoveTo and Foam::Xfer
|
||||
template<class T>
|
||||
inline Xfer<T> xferTmp(Foam::tmp<T>&);
|
||||
inline Xfer<T> xferTmp(Foam::tmp<T>& tt);
|
||||
|
||||
|
||||
//- Construct by copying the contents of the \a arg
|
||||
@ -165,7 +165,7 @@ inline Xfer<T> xferTmp(Foam::tmp<T>&);
|
||||
//
|
||||
// \sa xferCopy, xferMove, xferMoveTo, xferTmp and Foam::Xfer
|
||||
template<class To, class From>
|
||||
inline Xfer<To> xferCopyTo(const From&);
|
||||
inline Xfer<To> xferCopyTo(const From& t);
|
||||
|
||||
|
||||
//- Construct by transferring the contents of the \a arg
|
||||
@ -180,7 +180,7 @@ inline Xfer<To> xferCopyTo(const From&);
|
||||
//
|
||||
// \sa xferCopy, xferCopyTo, xferMove, xferTmp and Foam::Xfer
|
||||
template<class To, class From>
|
||||
inline Xfer<To> xferMoveTo(From&);
|
||||
inline Xfer<To> xferMoveTo(From& t);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -83,7 +83,7 @@ template<class T>
|
||||
inline Foam::Xfer<T>::~Xfer()
|
||||
{
|
||||
delete ptr_;
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,15 +64,15 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Store object pointer
|
||||
inline explicit autoPtr(T* = 0);
|
||||
inline explicit autoPtr(T* p = nullptr);
|
||||
|
||||
//- Construct as copy by transferring pointer to this autoPtr and
|
||||
// setting the arguments pointer to nullptr
|
||||
inline autoPtr(const autoPtr<T>&);
|
||||
inline autoPtr(const autoPtr<T>& ap);
|
||||
|
||||
//- Construct either by transferring pointer or cloning.
|
||||
// Should only be called with type that supports cloning
|
||||
inline autoPtr(const autoPtr<T>&, const bool reuse);
|
||||
inline autoPtr(const autoPtr<T>& ap, const bool reuse);
|
||||
|
||||
|
||||
//- Destructor, delete object if pointer is not nullptr
|
||||
@ -97,11 +97,11 @@ public:
|
||||
|
||||
//- Set pointer to that given.
|
||||
// If object pointer already set issue a FatalError
|
||||
inline void set(T*);
|
||||
inline void set(T* p);
|
||||
|
||||
//- If object pointer already set, delete object and set to given
|
||||
// pointer
|
||||
inline void reset(T* = 0);
|
||||
inline void reset(T* p = nullptr);
|
||||
|
||||
//- Delete object (if the pointer is valid) and set pointer to
|
||||
// nullptr
|
||||
@ -143,10 +143,10 @@ public:
|
||||
inline const T* operator->() const;
|
||||
|
||||
//- Take over the object pointer from parameter
|
||||
inline void operator=(T*);
|
||||
inline void operator=(T* p);
|
||||
|
||||
//- Take over the object pointer from parameter
|
||||
inline void operator=(const autoPtr<T>&);
|
||||
inline void operator=(const autoPtr<T>& ap);
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap)
|
||||
:
|
||||
ptr_(ap.ptr_)
|
||||
{
|
||||
ap.ptr_ = 0;
|
||||
ap.ptr_ = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ inline Foam::autoPtr<T>::autoPtr(const autoPtr<T>& ap, const bool reuse)
|
||||
if (reuse)
|
||||
{
|
||||
ptr_ = ap.ptr_;
|
||||
ap.ptr_ = 0;
|
||||
ap.ptr_ = nullptr;
|
||||
}
|
||||
else if (ap.valid())
|
||||
{
|
||||
@ -90,7 +90,7 @@ template<class T>
|
||||
inline T* Foam::autoPtr<T>::ptr()
|
||||
{
|
||||
T* ptr = ptr_;
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ inline void Foam::autoPtr<T>::reset(T* p)
|
||||
template<class T>
|
||||
inline void Foam::autoPtr<T>::clear()
|
||||
{
|
||||
reset(0);
|
||||
reset(nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,19 +84,19 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Store object pointer
|
||||
inline explicit tmp(T* = 0);
|
||||
inline explicit tmp(T* tPtr = nullptr);
|
||||
|
||||
//- Store object const reference
|
||||
inline tmp(const T&);
|
||||
inline tmp(const T& tRef);
|
||||
|
||||
//- Construct copy and increment reference count
|
||||
inline tmp(const tmp<T>&);
|
||||
inline tmp(const tmp<T>& t);
|
||||
|
||||
//- Construct copy moving content, does not increment reference count
|
||||
inline tmp(const tmp<T>&&);
|
||||
inline tmp(const tmp<T>&& t);
|
||||
|
||||
//- Construct copy transferring content of temporary if required
|
||||
inline tmp(const tmp<T>&, bool allowTransfer);
|
||||
inline tmp(const tmp<T>& t, bool allowTransfer);
|
||||
|
||||
|
||||
//- Destructor: deletes temporary object when the reference count is 0
|
||||
@ -159,10 +159,10 @@ public:
|
||||
inline const T* operator->() const;
|
||||
|
||||
//- Assignment to pointer changing this tmp to a temporary T
|
||||
inline void operator=(T*);
|
||||
inline void operator=(T* tPtr);
|
||||
|
||||
//- Assignment transfering the temporary T to this tmp
|
||||
inline void operator=(const tmp<T>&);
|
||||
inline void operator=(const tmp<T>& t);
|
||||
};
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>&& t)
|
||||
{
|
||||
if (isTmp())
|
||||
{
|
||||
t.ptr_ = 0;
|
||||
t.ptr_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ inline Foam::tmp<T>::tmp(const tmp<T>& t, bool allowTransfer)
|
||||
{
|
||||
if (allowTransfer)
|
||||
{
|
||||
t.ptr_ = 0;
|
||||
t.ptr_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -215,7 +215,7 @@ inline T* Foam::tmp<T>::ptr() const
|
||||
}
|
||||
|
||||
T* ptr = ptr_;
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@ -234,12 +234,12 @@ inline void Foam::tmp<T>::clear() const
|
||||
if (ptr_->unique())
|
||||
{
|
||||
delete ptr_;
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_->operator--();
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,7 +372,7 @@ inline void Foam::tmp<T>::operator=(const tmp<T>& t)
|
||||
}
|
||||
|
||||
ptr_ = t.ptr_;
|
||||
t.ptr_ = 0;
|
||||
t.ptr_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -83,16 +83,16 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Store object pointer
|
||||
inline explicit tmpNrc(T* = 0);
|
||||
inline explicit tmpNrc(T* tPtr = nullptr);
|
||||
|
||||
//- Store object const reference
|
||||
inline tmpNrc(const T&);
|
||||
inline tmpNrc(const T& tRef);
|
||||
|
||||
//- Construct copy and increment reference count
|
||||
inline tmpNrc(const tmpNrc<T>&);
|
||||
inline tmpNrc(const tmpNrc<T>& t);
|
||||
|
||||
//- Construct copy transferring content of temporary if required
|
||||
inline tmpNrc(const tmpNrc<T>&, bool allowTransfer);
|
||||
inline tmpNrc(const tmpNrc<T>& t, bool allowTransfer);
|
||||
|
||||
|
||||
//- Destructor: deletes temporary object when the reference count is 0
|
||||
@ -149,10 +149,10 @@ public:
|
||||
inline const T* operator->() const;
|
||||
|
||||
//- Assignment to pointer changing this tmpNrc to a temporary T
|
||||
inline void operator=(T*);
|
||||
inline void operator=(T* tPtr);
|
||||
|
||||
//- Assignment transfering the temporary T to this tmpNrc
|
||||
inline void operator=(const tmpNrc<T>&);
|
||||
//- Assignment transferring the temporary T to this tmpNrc
|
||||
inline void operator=(const tmpNrc<T>& t);
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ inline Foam::tmpNrc<T>::tmpNrc(const tmpNrc<T>& t, bool allowTransfer)
|
||||
{
|
||||
if (allowTransfer)
|
||||
{
|
||||
t.ptr_ = 0;
|
||||
t.ptr_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -169,7 +169,7 @@ inline T* Foam::tmpNrc<T>::ptr() const
|
||||
}
|
||||
|
||||
T* ptr = ptr_;
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@ -186,7 +186,7 @@ inline void Foam::tmpNrc<T>::clear() const
|
||||
if (isTmp() && ptr_)
|
||||
{
|
||||
delete ptr_;
|
||||
ptr_ = 0;
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ inline void Foam::tmpNrc<T>::operator=(const tmpNrc<T>& t)
|
||||
}
|
||||
|
||||
ptr_ = t.ptr_;
|
||||
t.ptr_ = 0;
|
||||
t.ptr_ = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user