Commit d8c0167e authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: ensure that emptyLabelList is known from List.H

- treat as a List constant without requiring inclusion of ListOps.H

- replace use of emptyList<label>() with emptyLabelList directly.
  The emptyList<T>() casting is disallowed with many modern compilers
  and now marked as deprecated (expect early removal).

- relocate labelList typedef to List.H for more general access.
  Similar reasoning to having labelUList defined in UList.H
parent edb0d1dd
......@@ -2398,7 +2398,7 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
return *(contents_[getContent(contentIndex)]);
}
return emptyList<label>();
return Foam::emptyLabelList;
}
......
......@@ -2660,7 +2660,7 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
{
if (nodes_.empty())
{
return emptyList<label>();
return Foam::emptyLabelList;
}
labelBits index = findNode(0, sample);
......@@ -2675,7 +2675,7 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
return contents_[getContent(contentIndex)];
}
return emptyList<label>();
return Foam::emptyLabelList;
}
......
......@@ -69,8 +69,12 @@ template<class T> class BiIndirectList;
template<class T> Istream& operator>>(Istream& is, List<T>& list);
// Commonly required list types
// Common list types
typedef List<char> charList;
typedef List<label> labelList;
//- A zero-sized list of labels
extern const labelList emptyLabelList;
/*---------------------------------------------------------------------------*\
......
......@@ -26,7 +26,7 @@ License
#include "ListOps.H"
#include <numeric>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Global Data Members * * * * * * * * * * * * * //
const Foam::labelList Foam::emptyLabelList;
......
......@@ -54,10 +54,10 @@ SourceFiles
namespace Foam
{
extern const labelList emptyLabelList;
//- Return reference to zero-sized list. Compare to List::null() which returns
// null pointer cast as list reference.
//- Return reference to zero-sized list.
// Compare to List::null() which returns null pointer cast as list reference.
//
// \deprecated This cast is disallowed with many modern compilers (JUL-2018)
template<class Type>
static const List<Type>& emptyList()
{
......
......@@ -47,6 +47,13 @@ SourceFiles
namespace Foam
{
// Forward declarations
template<class T> class SubList;
// Common list types
typedef SubList<label> labelSubList;
/*---------------------------------------------------------------------------*\
Class SubList Declaration
\*---------------------------------------------------------------------------*/
......
......@@ -67,10 +67,11 @@ template<class T> class UList;
template<class T> Ostream& operator<<(Ostream&, const UList<T>&);
template<class T> Istream& operator>>(Istream&, UList<T>&);
// Commonly required list types
// Common list types
typedef UList<char> charUList;
typedef UList<label> labelUList;
/*---------------------------------------------------------------------------*\
Class UList Declaration
\*---------------------------------------------------------------------------*/
......
......@@ -64,9 +64,10 @@ Description
namespace Foam
{
// NB: labelUList is defined in UList itself
typedef List<label> labelList;
typedef SubList<label> labelSubList;
// labelUList = defined in UList.H
// labelList = defined in List.H
// labelSubList = defined in SubList.H
typedef List<labelList> labelListList;
typedef List<labelListList> labelListListList;
}
......
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