diff --git a/src/OSspecific/POSIX/regExp/regExpPosix.H b/src/OSspecific/POSIX/regExp/regExpPosix.H index 86c6147538dfd427c47e2c799b9ca1b23d86cf8d..84808e8d76b2d8d1d0853845285e49c5d94b0abe 100644 --- a/src/OSspecific/POSIX/regExp/regExpPosix.H +++ b/src/OSspecific/POSIX/regExp/regExpPosix.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011, 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011, 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -125,14 +125,15 @@ public: // Access //- Return true if a precompiled expression does not exist - inline bool empty() const; + inline bool empty() const noexcept; //- Return true if a precompiled expression exists - inline bool exists() const; + inline bool exists() const noexcept; //- The number of capture groups for a non-empty expression inline unsigned ngroups() const; + // Editing //- Clear expression. @@ -150,6 +151,7 @@ public: // \return True if the pattern was compiled bool set(const std::string& pattern, bool ignoreCase=false); + // Matching/Searching //- Find position within the text. diff --git a/src/OSspecific/POSIX/regExp/regExpPosixI.H b/src/OSspecific/POSIX/regExp/regExpPosixI.H index 75f84825067d486f28c60a27afd88a8c365a3eec..cd134153bc8fd071872fa1b96ef75d735dfed10a 100644 --- a/src/OSspecific/POSIX/regExp/regExpPosixI.H +++ b/src/OSspecific/POSIX/regExp/regExpPosixI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,15 +98,15 @@ inline Foam::regExpPosix::~regExpPosix() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -inline bool Foam::regExpPosix::empty() const +inline bool Foam::regExpPosix::empty() const noexcept { return !preg_; } -inline bool Foam::regExpPosix::exists() const +inline bool Foam::regExpPosix::exists() const noexcept { - return preg_ ? true : false; + return preg_; } diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H index fe9f32e6f751d68ceb31f2ec0ac9bc925cd26b0c..8e3b25a9627847192d32bc62a4e30794bbbd806c 100644 --- a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H +++ b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H @@ -283,7 +283,7 @@ public: //- Number of entries. inline label size() const noexcept; - //- Return true if the list is empty (ie, size() is zero). + //- True if the list is empty (ie, size() is zero). inline bool empty() const noexcept; //- The number of elements that can be stored with reallocating diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 84a643a649e8bef0a231744912d56fda3dc97e82..e138e3ff5005ad8eff169dd1696953ee3f443c54 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -233,13 +233,13 @@ public: // Access //- The size of the underlying table - inline label capacity() const; + inline label capacity() const noexcept; - //- Return number of elements in table - inline label size() const; + //- The number of elements in table + inline label size() const noexcept; - //- Return true if the hash table is empty - inline bool empty() const; + //- True if the hash table is empty + inline bool empty() const noexcept; //- Find and return a hashed entry. FatalError if it does not exist. inline T& at(const Key& key); diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.H index 7e02b89f9c47b771554603b50ab2af2b05b43848..4bee86d20201c6da83c6636ebe077f325da104eb 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.H @@ -62,8 +62,7 @@ struct HashTableCore static label canonicalSize(const label requested_size); //- Construct null - HashTableCore() - {} + HashTableCore() = default; //- Define template name and debug ClassName("HashTable"); @@ -105,8 +104,8 @@ struct HashTableCore inline const_iterator_pair(const TableType& tbl); - inline label size() const; - inline bool empty() const; + label size() const noexcept { return size_; } + bool empty() const noexcept { return !size_; } inline IteratorType begin() const; inline IteratorType cbegin() const; diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCoreI.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCoreI.H index 1e59a0baa5aff00b8b6a9defc0e723ca7905ccfc..6e1e1f7922b9a758c9e617d810286c1a6dd33b35 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCoreI.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCoreI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,22 +73,6 @@ inline Foam::HashTableCore::const_iterator_pair<IteratorType, TableType> {} -template<class IteratorType, class TableType> -inline Foam::label -Foam::HashTableCore::const_iterator_pair<IteratorType, TableType>::size() const -{ - return size_; -} - - -template<class IteratorType, class TableType> -inline bool -Foam::HashTableCore::const_iterator_pair<IteratorType, TableType>::empty() const -{ - return !size_; -} - - template<class IteratorType, class TableType> inline IteratorType Foam::HashTableCore::const_iterator_pair < diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H index d2b70816d28c69808dcc7407db5719cec2b6e0d1..250dae6515c60ca0b9bddd52af919a20548787ae 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H @@ -41,21 +41,21 @@ Foam::HashTable<T, Key, Hash>::hashKeyIndex(const Key& key) const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, class Key, class Hash> -inline Foam::label Foam::HashTable<T, Key, Hash>::capacity() const +inline Foam::label Foam::HashTable<T, Key, Hash>::capacity() const noexcept { return capacity_; } template<class T, class Key, class Hash> -inline Foam::label Foam::HashTable<T, Key, Hash>::size() const +inline Foam::label Foam::HashTable<T, Key, Hash>::size() const noexcept { return size_; } template<class T, class Key, class Hash> -inline bool Foam::HashTable<T, Key, Hash>::empty() const +inline bool Foam::HashTable<T, Key, Hash>::empty() const noexcept { return !size_; } diff --git a/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectList.H b/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectList.H index 833445c82b133570007886fb16982e912771b5e3..6d5307d1d0b46de63e487dba7d44650778440c64 100644 --- a/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectList.H +++ b/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -83,11 +83,11 @@ public: // Access - //- Return the number of elements in the list - inline label size() const; + //- The number of elements in the list + inline label size() const noexcept; - //- Return true if the list is empty (ie, size() is zero). - inline bool empty() const; + //- True if the list is empty (ie, size() is zero). + inline bool empty() const noexcept; inline const UList<T>& posList() const; inline const UList<T>& negList() const; diff --git a/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectListI.H b/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectListI.H index c930e522e94f5bd532d51302473969eb69b6f75e..5c3572eb04a2605f4cf86b3f0d370f2655daa9dd 100644 --- a/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectListI.H +++ b/src/OpenFOAM/containers/IndirectLists/BiIndirectList/BiIndirectListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -74,14 +74,14 @@ inline Foam::BiIndirectList<T>::BiIndirectList // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T> -inline Foam::label Foam::BiIndirectList<T>::size() const +inline Foam::label Foam::BiIndirectList<T>::size() const noexcept { return addressing_.size(); } template<class T> -inline bool Foam::BiIndirectList<T>::empty() const +inline bool Foam::BiIndirectList<T>::empty() const noexcept { return addressing_.empty(); } diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index e6bb07cd9f897032dc1cc7df7eb1baa6abb11453..33f1047a31c93225ff699ae3cf545b633cae02ed 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H @@ -153,11 +153,11 @@ public: // Member Functions - //- Return number of elements in list - inline label size() const; + //- The number of elements in list + inline label size() const noexcept; - //- Return true if the list is empty - inline bool empty() const; + //- True if the list is empty + inline bool empty() const noexcept; //- Return first entry inline link* first(); diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H index 4317b0ccadd604f622d906434433336aeb25ec4c..dcf8fa4f4a2ebf6706794fd3ee63e4b04a2e5d59 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H @@ -110,13 +110,13 @@ inline void Foam::DLListBase::link::deregister() } -inline Foam::label Foam::DLListBase::size() const +inline Foam::label Foam::DLListBase::size() const noexcept { return size_; } -inline bool Foam::DLListBase::empty() const +inline bool Foam::DLListBase::empty() const noexcept { return !size_; } diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H index c48913e39916e9e20ac1097f06c7495cf28d8d3f..b39c28d646c8557e54bf7a847cdfbe84d599ef58 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBase.H @@ -141,11 +141,11 @@ public: // Member Functions - //- Return number of elements in list - inline label size() const; + //- The number of elements in list + inline label size() const noexcept; - //- Return true if the list is empty - inline bool empty() const; + //- True if the list is empty + inline bool empty() const noexcept; //- Return first entry inline link* first(); diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H index 761c6ae72ace1669462a61774d3dcd787aa21ce2..1cb940765d720725345fad9475764169c21840ee 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/SLListBase/SLListBaseI.H @@ -69,13 +69,13 @@ inline IteratorType Foam::SLListBase::iterator_last() const // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline Foam::label Foam::SLListBase::size() const +inline Foam::label Foam::SLListBase::size() const noexcept { return size_; } -inline bool Foam::SLListBase::empty() const +inline bool Foam::SLListBase::empty() const noexcept { return !size_; } diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H index db45421c7ed5ae8ed200bd681bf044dcef32e79b..35406b920a79161825cf47231e91bad1c73312ae 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -141,11 +141,11 @@ public: // Access - //- Return the primary size, i.e. the number of rows - inline label size() const; + //- The primary size (the number of rows) + inline label size() const noexcept; - //- Return true if the number of rows is zero - inline bool empty() const; + //- True if the number of rows is zero + inline bool empty() const noexcept; //- Return the offset table (= size()+1) inline const List<label>& offsets() const; diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H index 8c5631937455a7b9a6ee9fb8d6b996e9c1b41593..6d35f22be52d085351e157a73412e199306a47de 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -118,14 +118,14 @@ Foam::CompactListList<T, Container>::null() template<class T, class Container> -inline Foam::label Foam::CompactListList<T, Container>::size() const +inline Foam::label Foam::CompactListList<T, Container>::size() const noexcept { return size_; } template<class T, class Container> -inline bool Foam::CompactListList<T, Container>::empty() const +inline bool Foam::CompactListList<T, Container>::empty() const noexcept { return !size_; } diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H index 9cfeb99fff0be5989defa726dfb72f03f3ddec94..88458d6cd7306d2a35292e021dbefcc8bb38f1e8 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H @@ -82,12 +82,11 @@ class DynamicList { static_assert(SizeMin > 0, "Invalid min size parameter"); - // Private data + // Private Data //- The capacity (allocated size) of the underlying list. label capacity_; -private: // Private Member Functions @@ -97,7 +96,6 @@ private: //- Subset elements in range label subsetElements(const labelRange& slice); - protected: // Protected Member Functions @@ -174,13 +172,13 @@ public: // Member Functions - // Access + // Access //- Normal lower capacity limit - the SizeMin template parameter - inline label min_size() const; + static constexpr label min_size() noexcept { return SizeMin; } //- Size of the underlying storage. - inline label capacity() const; + inline label capacity() const noexcept; // Edit diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H index 3fcbc5f98f434eced6b9b0c6f6583ee36c46babe..76f89957bc992aa99ff1424acbbb4b7f8273cdaf 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H @@ -220,14 +220,7 @@ inline Foam::DynamicList<T, SizeMin>::DynamicList // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, int SizeMin> -inline Foam::label Foam::DynamicList<T, SizeMin>::min_size() const -{ - return SizeMin; -} - - -template<class T, int SizeMin> -inline Foam::label Foam::DynamicList<T, SizeMin>::capacity() const +inline Foam::label Foam::DynamicList<T, SizeMin>::capacity() const noexcept { return capacity_; } diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 2f746ce028e8419c27907a3c86fee28c2ce337a6..c87607b8244474bdace13d31eb0ca8947595d1ea 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -541,7 +541,7 @@ void Foam::List<T>::operator=(std::initializer_list<T> list) List_ACCESS(T, (*this), vp); label i = 0; - for (const auto& val : list) + for (const T& val : list) { vp[i] = val; ++i; diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 019919ba57ccad0df195d1222fd7c6cf84c47ee3..443534764373a29abebac046437916bac763a087 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -55,7 +55,6 @@ namespace Foam { // Forward declarations - class Istream; class Ostream; @@ -112,6 +111,12 @@ class List public: + // Related types + + //- Declare type of subList + typedef SubList<T> subList; + + // Static Member Functions //- Return a null List @@ -199,12 +204,6 @@ public: ~List(); - // Related types - - //- Declare type of subList - typedef SubList<T> subList; - - // Member Functions // Edit diff --git a/src/OpenFOAM/containers/Lists/SubList/SubList.H b/src/OpenFOAM/containers/Lists/SubList/SubList.H index 70d9ddb3b5147caade5b763a94b4794e87fcff42..931e1ecc280f9190053e1ec71429e6cc36d38e06 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubList.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubList.H @@ -122,7 +122,7 @@ public: inline void operator=(const UList<T>& list); //- Assignment of all entries to the given value - inline void operator=(const T& t); + inline void operator=(const T& val); }; diff --git a/src/OpenFOAM/containers/Lists/SubList/SubListI.H b/src/OpenFOAM/containers/Lists/SubList/SubListI.H index 9975cd8ff539a97ec6829b75caeec8147b284cd6..4544c389a9b0fd7f3ea5033a43f6a88a012a2636 100644 --- a/src/OpenFOAM/containers/Lists/SubList/SubListI.H +++ b/src/OpenFOAM/containers/Lists/SubList/SubListI.H @@ -125,9 +125,9 @@ inline void Foam::SubList<T>::operator=(const UList<T>& list) template<class T> -inline void Foam::SubList<T>::operator=(const T& t) +inline void Foam::SubList<T>::operator=(const T& val) { - UList<T>::operator=(t); + UList<T>::operator=(val); } diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H index 8d90489f17d1b4d147f00e473400335e4b1efc58..98e2a20dc01d4719dc8971c637380159c8643bda 100644 --- a/src/OpenFOAM/containers/Lists/UList/UList.H +++ b/src/OpenFOAM/containers/Lists/UList/UList.H @@ -95,26 +95,13 @@ class UList T* __restrict__ v_; - // Private Member Functions - - //- No copy assignment (shallow copy) - // - // Assignment of UList<T> may need to be either shallow (copy pointer) - // or deep (copy elements) depending on context or the particular type - // of list derived from UList and it is confusing and prone to error - // for the default assignment to be either. The solution is to - // disallow default assignment and provide separate 'shallowCopy' and - // 'deepCopy' member functions - UList<T>& operator=(const UList<T>&) = delete; - - protected: // Protected Member Functions //- Override size to be inconsistent with allocated storage. // Use with care - inline void size(const label n); + inline void size(const label n) noexcept; //- Write the UList with its compound type void writeEntry(Ostream& os) const; @@ -124,6 +111,14 @@ protected: labelRange validateRange(const labelRange& range) const; + //- No copy assignment (default: shallow copy) + // + // Assignment may need to be shallow (copy pointer) + // or deep (copy elements) depending on context or type of list. + // Disallow default assignment and provide separate 'shallowCopy' and + // 'deepCopy' member functions. + UList<T>& operator=(const UList<T>&) = delete; + public: // STL type definitions @@ -415,14 +410,14 @@ public: // STL member functions - //- Return the number of elements in the UList - inline label size() const; + //- The number of elements in the UList + inline label size() const noexcept; - //- Return size of the largest possible UList - inline label max_size() const; + //- True if the UList is empty (ie, size() is zero) + inline bool empty() const noexcept; - //- Return true if the UList is empty (ie, size() is zero) - inline bool empty() const; + //- The size of the largest possible UList + static constexpr label max_size() noexcept { return labelMax; } //- Swap content with another UList of the same type in constant time inline void swap(UList<T>& list); @@ -468,7 +463,7 @@ public: friend Istream& operator>> <T> ( Istream& os, - UList<T>& L + UList<T>& list ); diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index a4cc91fce6a685b053ca1a3ab6688f09700dca66..26f2000e05946868f2dc821e1902839f7db5e9f6 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.H @@ -356,28 +356,21 @@ Foam::UList<T>::crend() const template<class T> -inline void Foam::UList<T>::size(const label n) +inline void Foam::UList<T>::size(const label n) noexcept { size_ = n; } template<class T> -inline Foam::label Foam::UList<T>::size() const +inline Foam::label Foam::UList<T>::size() const noexcept { return size_; } template<class T> -inline Foam::label Foam::UList<T>::max_size() const -{ - return labelMax; -} - - -template<class T> -inline bool Foam::UList<T>::empty() const +inline bool Foam::UList<T>::empty() const noexcept { return !size_; } diff --git a/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynList.H b/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynList.H index beef999e1fd61a58fbb680b4bfa42589f7a5d577..1ebff785271f1778ad9a6384507ab14695ede3fd 100644 --- a/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynList.H +++ b/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynList.H @@ -103,7 +103,8 @@ public: // Access //- Size of the underlying storage. - inline label capacity() const; + inline label capacity() const noexcept; + // Edit diff --git a/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynListI.H b/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynListI.H index 2b7a45f91732c2c18860d7baa98c6e67fb259827..e889940425f9e4f075a3807f40ddfe5baa73ecfd 100644 --- a/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynListI.H +++ b/src/OpenFOAM/containers/PtrLists/PtrDynList/PtrDynListI.H @@ -90,7 +90,7 @@ inline Foam::PtrDynList<T, SizeMin>::PtrDynList(UList<T*>& list) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, int SizeMin> -inline Foam::label Foam::PtrDynList<T, SizeMin>::capacity() const +inline Foam::label Foam::PtrDynList<T, SizeMin>::capacity() const noexcept { return capacity_; } diff --git a/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H b/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H index c97167eedfc1706d49ef974666948c0c88a925d5..948749b04d18c22654fcdb74ca065ca21b576805 100644 --- a/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H +++ b/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrList.H @@ -138,11 +138,11 @@ public: // Access - //- Return the number of elements in the list - inline label size() const; + //- The number of elements in the list + inline label size() const noexcept; - //- Return true if the list is empty (ie, size() is zero) - inline bool empty() const; + //- True if the list is empty (ie, size() is zero) + inline bool empty() const noexcept; //- Return reference to the first element of the list inline T& first(); diff --git a/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrListI.H b/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrListI.H index 6cb0b51360cbbc58ccd517ffe6f165e7fa46f2b8..b1aeeb0e4036686ee46ce5975c61bcd90dbdcc44 100644 --- a/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrListI.H +++ b/src/OpenFOAM/containers/PtrLists/UPtrList/UPtrListI.H @@ -86,14 +86,14 @@ inline Foam::UPtrList<T>::UPtrList(UList<T>& list) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T> -inline Foam::label Foam::UPtrList<T>::size() const +inline Foam::label Foam::UPtrList<T>::size() const noexcept { return ptrs_.size(); } template<class T> -inline bool Foam::UPtrList<T>::empty() const +inline bool Foam::UPtrList<T>::empty() const noexcept { return ptrs_.empty(); } diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H index 641b924692861c36dd559d359f23fe68fb3dcd5c..bb915555cfd86ad7a6847ed552a42c27aaaecfb5 100644 --- a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H +++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H @@ -172,7 +172,8 @@ public: // Access //- Size of the underlying storage. - inline label capacity() const; + inline label capacity() const noexcept; + // Edit diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H index 40569e6882fe8a779e8c94d9f04ea90a28b41e2a..33089431db1898db0fe630ea1dd7ab99a0e22462 100644 --- a/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H +++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldI.H @@ -222,7 +222,7 @@ inline Foam::DynamicField<T, SizeMin>::DynamicField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, int SizeMin> -inline Foam::label Foam::DynamicField<T, SizeMin>::capacity() const +inline Foam::label Foam::DynamicField<T, SizeMin>::capacity() const noexcept { return capacity_; } diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index da9969fdffaafd8f8298728c2113e7fb29a4a3fc..ee29e58a1c160db7f2d19a0cd10a575b655501f2 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -349,7 +349,7 @@ public: inline dlLibraryTable& libs(); //- The number of arguments - inline label size() const; + inline label size() const noexcept; //- Return arguments inline const stringList& args() const; diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index bfa5581272e41a646600b43a3035ac6af1bc64b7..a8948660580b317456b6d7d4b31f6ee8dd9f66d1 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.H @@ -123,7 +123,7 @@ inline Foam::dlLibraryTable& Foam::argList::libs() } -inline Foam::label Foam::argList::size() const +inline Foam::label Foam::argList::size() const noexcept { return args_.size(); } diff --git a/src/OpenFOAM/global/profiling/profiling.C b/src/OpenFOAM/global/profiling/profiling.C index 1008d617f22416f56a7b7a93111b7071ee367085..3ac047197de5ff9f05e9ac5e1b87ea871ed2020c 100644 --- a/src/OpenFOAM/global/profiling/profiling.C +++ b/src/OpenFOAM/global/profiling/profiling.C @@ -309,7 +309,7 @@ const Foam::Time& Foam::profiling::owner() const } -Foam::label Foam::profiling::size() const +Foam::label Foam::profiling::size() const noexcept { return stack_.size(); } diff --git a/src/OpenFOAM/global/profiling/profiling.H b/src/OpenFOAM/global/profiling/profiling.H index 002163c695be6814b41b9c71e6c7961e81040298..8114c626913d70fd61fd21f92f47955947264319 100644 --- a/src/OpenFOAM/global/profiling/profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -241,7 +241,7 @@ public: const Time& owner() const; //- The size of the current stack - label size() const; + label size() const noexcept; //- writeData member function required by regIOobject virtual bool writeData(Ostream& os) const; @@ -254,7 +254,6 @@ public: IOstream::compressionType ignoreAlwaysUncompressed, const bool valid ) const; - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/profiling/profilingInformation.H b/src/OpenFOAM/global/profiling/profilingInformation.H index 1231d696b67b232d79e3767174bcc0320d5b1a2f..dd365fb8360a5849c822ba6ed0df81825a429a0c 100644 --- a/src/OpenFOAM/global/profiling/profilingInformation.H +++ b/src/OpenFOAM/global/profiling/profilingInformation.H @@ -46,11 +46,10 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class profilingInformation; class Ostream; -// Forward declaration of friend functions and operators Ostream& operator<<(Ostream& os, const profilingInformation& info); diff --git a/src/OpenFOAM/primitives/strings/lists/CStringList.H b/src/OpenFOAM/primitives/strings/lists/CStringList.H index 6bb9d9f7efec0dd858666ac5f8a95d6810821407..4e03a79b7031cdd1a08adc0938621efee0ba38d9 100644 --- a/src/OpenFOAM/primitives/strings/lists/CStringList.H +++ b/src/OpenFOAM/primitives/strings/lists/CStringList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -137,10 +137,10 @@ public: // Access //- True if the size is zero. - inline bool empty() const; + inline bool empty() const noexcept; //- Return the number of C-strings (ie, argc) - inline int size() const; + inline int size() const noexcept; //- Return the list of C-strings (ie, argv) // The position at argc is a nullptr diff --git a/src/OpenFOAM/primitives/strings/lists/CStringListI.H b/src/OpenFOAM/primitives/strings/lists/CStringListI.H index 814160c91aa20c843983f63e9307de45424f9481..1b62bacc8497fa9879ae10bb623263ea28f69674 100644 --- a/src/OpenFOAM/primitives/strings/lists/CStringListI.H +++ b/src/OpenFOAM/primitives/strings/lists/CStringListI.H @@ -111,13 +111,13 @@ inline void Foam::CStringList::clear() } -inline bool Foam::CStringList::empty() const +inline bool Foam::CStringList::empty() const noexcept { return !argc_; } -inline int Foam::CStringList::size() const +inline int Foam::CStringList::size() const noexcept { return argc_; } diff --git a/src/OpenFOAM/primitives/strings/regex/regExpCxx.H b/src/OpenFOAM/primitives/strings/regex/regExpCxx.H index d56d16f927bd8a122334180b0d82bca85e9ec6f2..5d3ca70bbeca34cfa43b7fc5a26db92bb998e059 100644 --- a/src/OpenFOAM/primitives/strings/regex/regExpCxx.H +++ b/src/OpenFOAM/primitives/strings/regex/regExpCxx.H @@ -137,10 +137,10 @@ public: // Access //- Return true if expression is empty - inline bool empty() const; + inline bool empty() const noexcept; //- Return true if expression is non-empty - inline bool exists() const; + inline bool exists() const noexcept; //- The number of capture groups for a non-empty expression inline unsigned ngroups() const; @@ -148,6 +148,7 @@ public: // \return True if the pattern was set with ignore-case. inline bool nocase() const; + // Editing //- Clear expression. @@ -165,6 +166,7 @@ public: // \return True if the pattern was compiled bool set(const std::string& pattern, bool ignoreCase=false); + // Matching/Searching //- Find position within the text. diff --git a/src/OpenFOAM/primitives/strings/regex/regExpCxxI.H b/src/OpenFOAM/primitives/strings/regex/regExpCxxI.H index b60cbf1e8c9cfa2f571e316670d85673cb35a5a5..bf1d040da1e266565cd5015c8091120848be1135 100644 --- a/src/OpenFOAM/primitives/strings/regex/regExpCxxI.H +++ b/src/OpenFOAM/primitives/strings/regex/regExpCxxI.H @@ -112,13 +112,13 @@ inline Foam::regExpCxx::regExpCxx(const std::string& pattern, bool ignoreCase) // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -inline bool Foam::regExpCxx::empty() const +inline bool Foam::regExpCxx::empty() const noexcept { return !ok_; } -inline bool Foam::regExpCxx::exists() const +inline bool Foam::regExpCxx::exists() const noexcept { return ok_; } diff --git a/src/fileFormats/vtk/file/foamVtkSeriesWriter.H b/src/fileFormats/vtk/file/foamVtkSeriesWriter.H index a62340f5f22c4b26f781bae017a9d46c86693d77..8c4a2d3709a1045c950d8881efc4acbf50adbaf5 100644 --- a/src/fileFormats/vtk/file/foamVtkSeriesWriter.H +++ b/src/fileFormats/vtk/file/foamVtkSeriesWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -182,10 +182,10 @@ public: // Member Functions //- True if there are no data sets - inline bool empty() const; + inline bool empty() const noexcept; //- The number of data sets - inline label size() const; + inline label size() const noexcept; // Content Management diff --git a/src/fileFormats/vtk/file/foamVtkSeriesWriterI.H b/src/fileFormats/vtk/file/foamVtkSeriesWriterI.H index 263e860b65c87994f1eb6b70e29f211c0aceaf29..7c7b37a668f5dd53d1ebf906202c546cbd405752 100644 --- a/src/fileFormats/vtk/file/foamVtkSeriesWriterI.H +++ b/src/fileFormats/vtk/file/foamVtkSeriesWriterI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,13 +25,13 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline bool Foam::vtk::seriesWriter::empty() const +inline bool Foam::vtk::seriesWriter::empty() const noexcept { return entries_.empty(); } -inline Foam::label Foam::vtk::seriesWriter::size() const +inline Foam::label Foam::vtk::seriesWriter::size() const noexcept { return entries_.size(); } diff --git a/src/fileFormats/vtk/part/foamVtuCells.H b/src/fileFormats/vtk/part/foamVtuCells.H index 97cb36398acf070fdf9ec7a3c2dcc1fcc04a85cb..d6928fc902e2bea0d3f7a11c5fa5f67a32e9a26e 100644 --- a/src/fileFormats/vtk/part/foamVtuCells.H +++ b/src/fileFormats/vtk/part/foamVtuCells.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -174,10 +174,10 @@ public: inline bool decomposeRequested() const; //- True if no cellTypes are populated. - inline bool empty() const; + inline bool empty() const noexcept; //- The size of populated cellTypes. - inline label size() const; + inline label size() const noexcept; // Edit diff --git a/src/fileFormats/vtk/part/foamVtuCellsI.H b/src/fileFormats/vtk/part/foamVtuCellsI.H index 49cbe1871750f729b28c92c8abdc193747401e29..e4149a48ce30623a08d85a64d992b8aa327f2d6d 100644 --- a/src/fileFormats/vtk/part/foamVtuCellsI.H +++ b/src/fileFormats/vtk/part/foamVtuCellsI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,13 +41,13 @@ inline bool Foam::vtk::vtuCells::decomposeRequested() const } -inline bool Foam::vtk::vtuCells::empty() const +inline bool Foam::vtk::vtuCells::empty() const noexcept { return cellTypes_.empty(); } -inline Foam::label Foam::vtk::vtuCells::size() const +inline Foam::label Foam::vtk::vtuCells::size() const noexcept { return cellTypes_.size(); }