Commit 91b5739a authored by Mark Olesen's avatar Mark Olesen
Browse files

List: drop unneeded assigment of null pointer in constructors

parent fb1e155e
......@@ -152,17 +152,12 @@ inline void Foam::FixedList<T, Size>::checkSize(const label size) const
}
// Check index i is within valid range (0 ... size-1).
// Check index i is within valid range (0 ... size-1)
// The check for zero-sized list is already done in static assert
template<class T, unsigned Size>
inline void Foam::FixedList<T, Size>::checkIndex(const label i) const
{
if (!Size)
{
FatalErrorIn("FixedList<T, Size>::checkIndex(const label)")
<< "attempt to access element from zero-sized list"
<< abort(FatalError);
}
else if (i < 0 || i >= label(Size))
if (i < 0 || unsigned(i) >= Size)
{
FatalErrorIn("FixedList<T, Size>::checkIndex(const label)")
<< "index " << i << " out of range 0 ... " << (Size-1)
......
......@@ -58,10 +58,6 @@ Foam::List<T>::List(const label s)
{
this->v_ = new T[this->size_];
}
else
{
this->v_ = 0;
}
}
......@@ -87,10 +83,6 @@ Foam::List<T>::List(const label s, const T& a)
List_ELEM((*this), vp, i) = a;
List_END_FOR_ALL
}
else
{
this->v_ = 0;
}
}
......@@ -119,16 +111,12 @@ Foam::List<T>::List(const List<T>& a)
List_END_FOR_ALL
}
}
else
{
this->v_ = 0;
}
}
// Construct by transferring the parameter contents
template<class T>
Foam::List<T>::List(const Xfer<List<T> >& lst)
Foam::List<T>::List(const Xfer< List<T> >& lst)
{
transfer(lst());
}
......@@ -165,10 +153,6 @@ Foam::List<T>::List(List<T>& a, bool reUse)
List_END_FOR_ALL
}
}
else
{
this->v_ = 0;
}
}
......@@ -188,10 +172,6 @@ Foam::List<T>::List(const UList<T>& a, const unallocLabelList& map)
List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i]));
List_END_FOR_ALL
}
else
{
this->v_ = 0;
}
}
......@@ -234,7 +214,7 @@ Foam::List<T>::List(const FixedList<T, Size>& lst)
:
UList<T>(NULL, Size)
{
if (Size)
if (this->size_)
{
this->v_ = new T[this->size_];
......@@ -243,10 +223,6 @@ Foam::List<T>::List(const FixedList<T, Size>& lst)
this->operator[](i) = lst[i];
}
}
else
{
this->v_ = 0;
}
}
......@@ -265,10 +241,6 @@ Foam::List<T>::List(const PtrList<T>& lst)
this->operator[](i) = lst[i];
}
}
else
{
this->v_ = 0;
}
}
......@@ -293,10 +265,6 @@ Foam::List<T>::List(const SLList<T>& lst)
this->operator[](i++) = iter();
}
}
else
{
this->v_ = 0;
}
}
......@@ -315,10 +283,6 @@ Foam::List<T>::List(const IndirectList<T>& lst)
this->operator[](i) = lst[i];
}
}
else
{
this->v_ = 0;
}
}
......@@ -337,10 +301,6 @@ Foam::List<T>::List(const UIndirectList<T>& lst)
this->operator[](i) = lst[i];
}
}
else
{
this->v_ = 0;
}
}
......@@ -359,10 +319,6 @@ Foam::List<T>::List(const BiIndirectList<T>& lst)
this->operator[](i) = lst[i];
}
}
else
{
this->v_ = 0;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment