ENH: consistent noexcept for list iterators and raw-data accessors

- add byteSize to FixedList and Matrix, for possible streaming

ENH: expose data/cdata for PackedList, bitSet
This commit is contained in:
Mark Olesen
2021-01-19 16:24:18 +01:00
parent 64c6f350ae
commit 9b56c6b1ac
27 changed files with 338 additions and 299 deletions

View File

@ -161,7 +161,7 @@ public:
// + (numElem % elem_per_block) ? 1 : 0
// \endcode
// But avoiding the modulus operation
static constexpr label num_blocks(label numElem)
static constexpr label num_blocks(label numElem) noexcept
{
return ((numElem - 1 + elem_per_block) / elem_per_block);
}
@ -385,10 +385,6 @@ public:
// Low-level access
//- The number of bytes used in the underlying storage
//- including any unused padding.
inline std::streamsize byteSize() const;
//- The number of internal storage blocks
inline label nBlocks() const;
@ -399,6 +395,16 @@ public:
// Manipulate with utmost caution
inline List<unsigned int>& storage();
//- A const pointer to the raw storage
inline const unsigned int* cdata() const noexcept;
//- A pointer to the raw storage
inline unsigned int* data() noexcept;
//- The number of bytes used in the raw storage
//- including any unused padding.
inline std::streamsize byteSize() const noexcept;
// IO

View File

@ -548,7 +548,21 @@ inline Foam::label Foam::PackedList<Width>::nBlocks() const
template<unsigned Width>
inline std::streamsize Foam::PackedList<Width>::byteSize() const
inline const unsigned int* Foam::PackedList<Width>::cdata() const noexcept
{
return blocks_.cdata();
}
template<unsigned Width>
inline unsigned int* Foam::PackedList<Width>::data() noexcept
{
return blocks_.data();
}
template<unsigned Width>
inline std::streamsize Foam::PackedList<Width>::byteSize() const noexcept
{
return num_blocks(size()) * sizeof(block_type);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -127,7 +127,7 @@ Foam::Istream& Foam::PackedList<Width>::read(Istream& is)
{
is.read
(
reinterpret_cast<char*>(list.storage().data()),
reinterpret_cast<char*>(list.data()),
list.byteSize()
);
@ -249,7 +249,7 @@ Foam::Ostream& Foam::PackedList<Width>::writeList
// write(...) includes surrounding start/end delimiters
os.write
(
reinterpret_cast<const char*>(list.storage().cdata()),
reinterpret_cast<const char*>(list.cdata()),
list.byteSize()
);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,7 +87,7 @@ Foam::Ostream& Foam::bitSet::writeList
// write(...) includes surrounding start/end delimiters
os.write
(
reinterpret_cast<const char*>(list.storage().cdata()),
reinterpret_cast<const char*>(list.cdata()),
list.byteSize()
);
}

View File

@ -31,6 +31,20 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, unsigned N>
std::streamsize Foam::FixedList<T, N>::byteSize() const
{
if (!is_contiguous<T>::value)
{
FatalErrorInFunction
<< "Invalid for non-contiguous data types"
<< abort(FatalError);
}
return N*sizeof(T);
}
template<class T, unsigned N>
Foam::label Foam::FixedList<T, N>::find(const T& val, label pos) const
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -216,6 +216,8 @@ public:
//- The last element of the list, position [N-1]
inline const T& last() const noexcept;
//- The number of bytes stored by the list data for contiguous types
std::streamsize byteSize() const;
//- Return the forward circular index, i.e. next index
//- which returns to the first at the end of the list
@ -340,25 +342,25 @@ public:
// Random access iterator (non-const)
//- Return an iterator to begin traversing the FixedList
inline iterator begin();
inline iterator begin() noexcept;
//- Return an iterator to end traversing the FixedList
inline iterator end();
inline iterator end() noexcept;
// Random access iterator (const)
//- Return const_iterator to begin traversing the constant FixedList
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- Return const_iterator to end traversing the constant FixedList
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- Return const_iterator to begin traversing the constant FixedList
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- Return const_iterator to end traversing the constant FixedList
inline const_iterator end() const;
inline const_iterator end() const noexcept;
// Reverse iterator (non-const)

View File

@ -503,7 +503,7 @@ inline void Foam::FixedList<T, N>::operator=(FixedList<T, N>&& list)
template<class T, unsigned N>
inline typename Foam::FixedList<T, N>::iterator
Foam::FixedList<T, N>::begin()
Foam::FixedList<T, N>::begin() noexcept
{
return v_;
}
@ -511,7 +511,7 @@ Foam::FixedList<T, N>::begin()
template<class T, unsigned N>
inline typename Foam::FixedList<T, N>::const_iterator
Foam::FixedList<T, N>::begin() const
Foam::FixedList<T, N>::begin() const noexcept
{
return v_;
}
@ -519,7 +519,7 @@ Foam::FixedList<T, N>::begin() const
template<class T, unsigned N>
inline typename Foam::FixedList<T, N>::const_iterator
Foam::FixedList<T, N>::cbegin() const
Foam::FixedList<T, N>::cbegin() const noexcept
{
return v_;
}
@ -527,7 +527,7 @@ Foam::FixedList<T, N>::cbegin() const
template<class T, unsigned N>
inline typename Foam::FixedList<T, N>::iterator
Foam::FixedList<T, N>::end()
Foam::FixedList<T, N>::end() noexcept
{
return (v_ + N);
}
@ -535,7 +535,7 @@ Foam::FixedList<T, N>::end()
template<class T, unsigned N>
inline typename Foam::FixedList<T, N>::const_iterator
Foam::FixedList<T, N>::end() const
Foam::FixedList<T, N>::end() const noexcept
{
return (v_ + N);
}
@ -543,7 +543,7 @@ Foam::FixedList<T, N>::end() const
template<class T, unsigned N>
inline typename Foam::FixedList<T, N>::const_iterator
Foam::FixedList<T, N>::cend() const
Foam::FixedList<T, N>::cend() const noexcept
{
return (v_ + N);
}

View File

@ -213,8 +213,8 @@ Foam::PackedList<Width> Foam::reorder
}
// Verify addresses (for movable refs)
// Info<< "reordered in " << name(input.storage().cdata()) << nl
// << "reordered out " << name(output.storage().cdata()) << nl;
// Info<< "reordered in " << name(input.cdata()) << nl
// << "reordered out " << name(output.cdata()) << nl;
return output;
}
@ -231,7 +231,7 @@ void Foam::inplaceReorder
input = reorder(oldToNew, input, prune);
// Verify address (for movable refs)
// Info<< "now have " << name(input.storage().cdata()) << nl;
// Info<< "now have " << name(input.cdata()) << nl;
}

View File

@ -193,7 +193,7 @@ std::streamsize Foam::UList<T>::byteSize() const
if (!is_contiguous<T>::value)
{
FatalErrorInFunction
<< "Cannot return binary size of a list with non-primitive elements"
<< "Invalid for non-contiguous data types"
<< abort(FatalError);
}

View File

@ -248,22 +248,15 @@ public:
//- Return reverse circular value (ie, previous value in the list)
inline T& rcValue(const label i);
//- Return the binary size in number of characters of the UList
//- if the element is a primitive type
// i.e. is_contiguous<T>::value == true.
// Note that is of type streamsize since used in stream ops
std::streamsize byteSize() const;
//- Return a const pointer to the first data element.
// Similar to the STL front() method and the string::data() method
// This can be used (with caution) when interfacing with C code
inline const T* cdata() const;
inline const T* cdata() const noexcept;
//- Return a pointer to the first data element.
// Similar to the STL front() method and the string::data() method
// This can be used (with caution) when interfacing with C code
inline T* data();
inline T* data() noexcept;
//- Return the first element of the list
inline T& first();
@ -277,6 +270,10 @@ public:
//- Return the last element of the list
inline const T& last() const;
//- The number of bytes stored by the list data for contiguous types
// \note is a std::streamsize since it is used in stream ops
std::streamsize byteSize() const;
// Check
@ -371,25 +368,25 @@ public:
// Random access iterator (non-const)
//- Return an iterator to begin traversing the UList
inline iterator begin();
inline iterator begin() noexcept;
//- Return an iterator to end traversing the UList
inline iterator end();
inline iterator end() noexcept;
// Random access iterator (const)
//- Return const_iterator to begin traversing the constant UList
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- Return const_iterator to end traversing the constant UList
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- Return const_iterator to begin traversing the constant UList
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- Return const_iterator to end traversing the constant UList
inline const_iterator end() const;
inline const_iterator end() const noexcept;
// Reverse iterators (non-const)

View File

@ -195,14 +195,14 @@ inline const T& Foam::UList<T>::last() const
template<class T>
inline const T* Foam::UList<T>::cdata() const
inline const T* Foam::UList<T>::cdata() const noexcept
{
return v_;
}
template<class T>
inline T* Foam::UList<T>::data()
inline T* Foam::UList<T>::data() noexcept
{
return v_;
}
@ -273,42 +273,42 @@ inline Foam::UList<T>::operator const Foam::List<T>&() const
template<class T>
inline typename Foam::UList<T>::iterator
Foam::UList<T>::begin()
Foam::UList<T>::begin() noexcept
{
return v_;
}
template<class T>
inline typename Foam::UList<T>::const_iterator
Foam::UList<T>::begin() const
Foam::UList<T>::begin() const noexcept
{
return v_;
}
template<class T>
inline typename Foam::UList<T>::const_iterator
Foam::UList<T>::cbegin() const
Foam::UList<T>::cbegin() const noexcept
{
return v_;
}
template<class T>
inline typename Foam::UList<T>::iterator
Foam::UList<T>::end()
Foam::UList<T>::end() noexcept
{
return (v_ + size_);
}
template<class T>
inline typename Foam::UList<T>::const_iterator
Foam::UList<T>::end() const
Foam::UList<T>::end() const noexcept
{
return (v_ + size_);
}
template<class T>
inline typename Foam::UList<T>::const_iterator
Foam::UList<T>::cend() const
Foam::UList<T>::cend() const noexcept
{
return (v_ + size_);
}

View File

@ -235,6 +235,7 @@ public:
//- Random-access iterator with non-const access
class iterator
{
// Pointer to parent
T** ptr_;
public:
@ -247,51 +248,52 @@ public:
friend class const_iterator;
//- Construct for a given entry
inline iterator(T** ptr);
inline iterator(T** ptr) noexcept;
// Member functions
// Member Functions
//- Return pointer, can be nullptr.
inline pointer get() const;
// Member operators
inline bool operator==(const iterator& iter) const;
inline bool operator!=(const iterator& iter) const;
// Member Operators
inline pointer operator->() const;
inline reference operator*() const;
inline reference operator()() const;
// Forward iteration
inline iterator& operator++();
inline iterator operator++(int);
inline iterator& operator--();
inline iterator operator--(int);
// Random-access
inline iterator& operator+=(difference_type n);
inline iterator& operator-=(difference_type n);
inline iterator operator+(difference_type n) const;
inline iterator operator-(difference_type n) const;
inline difference_type operator-(const iterator& iter) const;
reference operator()() const { return this->operator*(); }
inline reference operator[](difference_type n) const;
inline bool operator<(const iterator& iter) const;
inline bool operator>(const iterator& iter) const;
// Forward iteration
inline iterator& operator++() noexcept;
inline iterator operator++(int) noexcept;
inline bool operator<=(const iterator& iter) const;
inline bool operator>=(const iterator& iter) const;
inline iterator& operator--() noexcept;
inline iterator operator--(int) noexcept;
// Random-access
inline iterator& operator+=(difference_type n) noexcept;
inline iterator& operator-=(difference_type n) noexcept;
inline iterator operator+(difference_type n) const noexcept;
inline iterator operator-(difference_type n) const noexcept;
inline difference_type operator-(const iterator& iter)
const noexcept;
inline bool operator==(const iterator& iter) const noexcept;
inline bool operator!=(const iterator& iter) const noexcept;
inline bool operator<(const iterator& iter) const noexcept;
inline bool operator>(const iterator& iter) const noexcept;
inline bool operator<=(const iterator& iter) const noexcept;
inline bool operator>=(const iterator& iter) const noexcept;
};
//- Random-access iterator with const access
class const_iterator
{
// Pointer to parent
const T* const* ptr_;
public:
@ -303,68 +305,68 @@ public:
using reference = const T&;
//- Construct for a given entry
inline const_iterator(const T* const* ptr);
inline const_iterator(const T* const* ptr) noexcept;
//- Copy construct from non-const iterator
inline const_iterator(const iterator& iter);
inline const_iterator(const iterator& iter) noexcept;
// Member functions
// Member Functions
//- Return pointer, can be nullptr.
inline pointer get() const;
// Member operators
inline bool operator==(const const_iterator& iter) const;
inline bool operator!=(const const_iterator& iter) const;
// Member Operators
inline pointer operator->() const;
inline reference operator*() const;
inline reference operator()() const;
// Forward iteration
inline const_iterator& operator++();
inline const_iterator operator++(int);
inline const_iterator& operator--();
inline const_iterator operator--(int);
// Random-access
inline const_iterator& operator+=(difference_type n);
inline const_iterator& operator-=(difference_type n);
inline const_iterator operator+(difference_type n) const;
inline const_iterator operator-(difference_type n) const;
inline difference_type operator-(const const_iterator& iter) const;
reference operator()() const { return this->operator*(); }
inline reference operator[](difference_type n) const;
inline bool operator<(const const_iterator& iter) const;
inline bool operator>(const const_iterator& iter) const;
// Forward iteration
inline const_iterator& operator++() noexcept;
inline const_iterator operator++(int) noexcept;
inline bool operator<=(const const_iterator& iter) const;
inline bool operator>=(const const_iterator& iter) const;
inline const_iterator& operator--() noexcept;
inline const_iterator operator--(int) noexcept;
// Random-access
inline const_iterator& operator+=(difference_type n) noexcept;
inline const_iterator& operator-=(difference_type n) noexcept;
inline const_iterator operator+(difference_type n) const noexcept;
inline const_iterator operator-(difference_type n) const noexcept;
inline difference_type operator-(const const_iterator& iter)
const noexcept;
inline bool operator==(const const_iterator& iter) const noexcept;
inline bool operator!=(const const_iterator& iter) const noexcept;
inline bool operator<(const const_iterator& iter) const noexcept;
inline bool operator>(const const_iterator& iter) const noexcept;
inline bool operator<=(const const_iterator& iter) const noexcept;
inline bool operator>=(const const_iterator& iter) const noexcept;
};
//- Return an iterator to begin traversing the UPtrList
inline iterator begin();
inline iterator begin() noexcept;
//- Return an iterator to end traversing the UPtrList
inline iterator end();
inline iterator end() noexcept;
//- Return an const_iterator to begin traversing the UPtrList
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- Return an const_iterator to end traversing the UPtrList
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- Return an const_iterator to begin traversing the UPtrList
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- Return an const_iterator to end traversing the UPtrList
inline const_iterator end() const;
inline const_iterator end() const noexcept;
// IOstream operator
@ -375,7 +377,6 @@ public:
Ostream& os,
const UPtrList<T>& list
);
};

View File

@ -252,7 +252,8 @@ inline const T* Foam::UPtrList<T>::operator()(const label i) const
// * * * * * * * * * * * * * * * * iterator * * * * * * * * * * * * * * * * //
template<class T>
inline Foam::UPtrList<T>::iterator::iterator(T** ptr)
inline Foam::UPtrList<T>::iterator::
iterator(T** ptr) noexcept
:
ptr_(ptr)
{}
@ -265,20 +266,6 @@ inline T* Foam::UPtrList<T>::iterator::get() const
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::operator==(const iterator& iter) const
{
return ptr_ == iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::operator!=(const iterator& iter) const
{
return ptr_ != iter.ptr_;
}
template<class T>
inline T* Foam::UPtrList<T>::iterator::operator->() const
{
@ -294,15 +281,14 @@ inline T& Foam::UPtrList<T>::iterator::operator*() const
template<class T>
inline T& Foam::UPtrList<T>::iterator::operator()() const
inline T& Foam::UPtrList<T>::iterator::operator[](label n) const
{
return **ptr_;
return **(ptr_ + n);
}
template<class T>
inline typename Foam::UPtrList<T>::iterator&
Foam::UPtrList<T>::iterator::operator++()
Foam::UPtrList<T>::iterator::operator++() noexcept
{
++ptr_;
return *this;
@ -311,7 +297,7 @@ Foam::UPtrList<T>::iterator::operator++()
template<class T>
inline typename Foam::UPtrList<T>::iterator
Foam::UPtrList<T>::iterator::operator++(int)
Foam::UPtrList<T>::iterator::operator++(int) noexcept
{
iterator iter(*this);
++ptr_;
@ -321,7 +307,7 @@ Foam::UPtrList<T>::iterator::operator++(int)
template<class T>
inline typename Foam::UPtrList<T>::iterator&
Foam::UPtrList<T>::iterator::operator--()
Foam::UPtrList<T>::iterator::operator--() noexcept
{
--ptr_;
return *this;
@ -330,7 +316,7 @@ Foam::UPtrList<T>::iterator::operator--()
template<class T>
inline typename Foam::UPtrList<T>::iterator
Foam::UPtrList<T>::iterator::operator--(int)
Foam::UPtrList<T>::iterator::operator--(int) noexcept
{
iterator iter(*this);
--ptr_;
@ -340,7 +326,7 @@ Foam::UPtrList<T>::iterator::operator--(int)
template<class T>
inline typename Foam::UPtrList<T>::iterator&
Foam::UPtrList<T>::iterator::operator+=(label n)
Foam::UPtrList<T>::iterator::operator+=(label n) noexcept
{
ptr_ += n;
return *this;
@ -349,7 +335,7 @@ Foam::UPtrList<T>::iterator::operator+=(label n)
template<class T>
inline typename Foam::UPtrList<T>::iterator&
Foam::UPtrList<T>::iterator::operator-=(label n)
Foam::UPtrList<T>::iterator::operator-=(label n) noexcept
{
ptr_ -= n;
return *this;
@ -358,7 +344,7 @@ Foam::UPtrList<T>::iterator::operator-=(label n)
template<class T>
inline typename Foam::UPtrList<T>::iterator
Foam::UPtrList<T>::iterator::operator+(label n) const
Foam::UPtrList<T>::iterator::operator+(label n) const noexcept
{
return iterator(ptr_ + n);
}
@ -366,7 +352,7 @@ Foam::UPtrList<T>::iterator::operator+(label n) const
template<class T>
inline typename Foam::UPtrList<T>::iterator
Foam::UPtrList<T>::iterator::operator-(label n) const
Foam::UPtrList<T>::iterator::operator-(label n) const noexcept
{
return iterator(ptr_ - n);
}
@ -374,42 +360,56 @@ Foam::UPtrList<T>::iterator::operator-(label n) const
template<class T>
inline Foam::label
Foam::UPtrList<T>::iterator::operator-(const iterator& iter) const
Foam::UPtrList<T>::iterator::
operator-(const iterator& iter) const noexcept
{
return (ptr_ - iter.ptr_);
}
template<class T>
inline T& Foam::UPtrList<T>::iterator::operator[](label n) const
inline bool Foam::UPtrList<T>::iterator::
operator==(const iterator& iter) const noexcept
{
return *(*this + n);
return ptr_ == iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::operator<(const iterator& iter) const
inline bool Foam::UPtrList<T>::iterator::
operator!=(const iterator& iter) const noexcept
{
return ptr_ != iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::
operator<(const iterator& iter) const noexcept
{
return ptr_ < iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::operator>(const iterator& iter) const
inline bool Foam::UPtrList<T>::iterator::
operator>(const iterator& iter) const noexcept
{
return ptr_ > iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::operator<=(const iterator& iter) const
inline bool Foam::UPtrList<T>::iterator::
operator<=(const iterator& iter) const noexcept
{
return ptr_ <= iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::iterator::operator>=(const iterator& iter) const
inline bool Foam::UPtrList<T>::iterator::
operator>=(const iterator& iter) const noexcept
{
return ptr_ >= iter.ptr_;
}
@ -418,14 +418,16 @@ inline bool Foam::UPtrList<T>::iterator::operator>=(const iterator& iter) const
// * * * * * * * * * * * * * * * const_iterator * * * * * * * * * * * * * * //
template<class T>
inline Foam::UPtrList<T>::const_iterator::const_iterator(const T* const* ptr)
inline Foam::UPtrList<T>::const_iterator::
const_iterator(const T* const* ptr) noexcept
:
ptr_(ptr)
{}
template<class T>
inline Foam::UPtrList<T>::const_iterator::const_iterator(const iterator& iter)
inline Foam::UPtrList<T>::const_iterator::
const_iterator(const iterator& iter) noexcept
:
ptr_(iter.ptr_)
{}
@ -438,26 +440,6 @@ inline const T* Foam::UPtrList<T>::const_iterator::get() const
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::operator==
(
const const_iterator& iter
) const
{
return ptr_ == iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::operator!=
(
const const_iterator& iter
) const
{
return ptr_ != iter.ptr_;
}
template<class T>
inline const T* Foam::UPtrList<T>::const_iterator::operator->() const
{
@ -473,15 +455,16 @@ inline const T& Foam::UPtrList<T>::const_iterator::operator*() const
template<class T>
inline const T& Foam::UPtrList<T>::const_iterator::operator()() const
inline const T&
Foam::UPtrList<T>::const_iterator::operator[](label n) const
{
return **ptr_;
return **(ptr_ + n);
}
template<class T>
inline typename Foam::UPtrList<T>::const_iterator&
Foam::UPtrList<T>::const_iterator::operator++()
Foam::UPtrList<T>::const_iterator::operator++() noexcept
{
++ptr_;
return *this;
@ -490,7 +473,7 @@ Foam::UPtrList<T>::const_iterator::operator++()
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::const_iterator::operator++(int)
Foam::UPtrList<T>::const_iterator::operator++(int) noexcept
{
const_iterator iter(*this);
++ptr_;
@ -500,7 +483,7 @@ Foam::UPtrList<T>::const_iterator::operator++(int)
template<class T>
inline typename Foam::UPtrList<T>::const_iterator&
Foam::UPtrList<T>::const_iterator::operator--()
Foam::UPtrList<T>::const_iterator::operator--() noexcept
{
--ptr_;
return *this;
@ -509,7 +492,7 @@ Foam::UPtrList<T>::const_iterator::operator--()
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::const_iterator::operator--(int)
Foam::UPtrList<T>::const_iterator::operator--(int) noexcept
{
const_iterator iter(*this);
--ptr_;
@ -519,7 +502,7 @@ Foam::UPtrList<T>::const_iterator::operator--(int)
template<class T>
inline typename Foam::UPtrList<T>::const_iterator&
Foam::UPtrList<T>::const_iterator::operator+=(label n)
Foam::UPtrList<T>::const_iterator::operator+=(label n) noexcept
{
ptr_ += n;
return *this;
@ -528,7 +511,7 @@ Foam::UPtrList<T>::const_iterator::operator+=(label n)
template<class T>
inline typename Foam::UPtrList<T>::const_iterator&
Foam::UPtrList<T>::const_iterator::operator-=(label n)
Foam::UPtrList<T>::const_iterator::operator-=(label n) noexcept
{
ptr_ -= n;
return *this;
@ -537,7 +520,7 @@ Foam::UPtrList<T>::const_iterator::operator-=(label n)
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::const_iterator::operator+(label n) const
Foam::UPtrList<T>::const_iterator::operator+(label n) const noexcept
{
return const_iterator(ptr_ + n);
}
@ -545,7 +528,7 @@ Foam::UPtrList<T>::const_iterator::operator+(label n) const
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::const_iterator::operator-(label n) const
Foam::UPtrList<T>::const_iterator::operator-(label n) const noexcept
{
return const_iterator(ptr_ - n);
}
@ -553,55 +536,56 @@ Foam::UPtrList<T>::const_iterator::operator-(label n) const
template<class T>
inline Foam::label
Foam::UPtrList<T>::const_iterator::operator-(const const_iterator& iter) const
Foam::UPtrList<T>::const_iterator::
operator-(const const_iterator& iter) const noexcept
{
return (ptr_ - iter.ptr_);
}
template<class T>
inline const T&
Foam::UPtrList<T>::const_iterator::operator[](label n) const
inline bool Foam::UPtrList<T>::const_iterator::
operator==(const const_iterator& iter) const noexcept
{
return *(*this + n);
return ptr_ == iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::operator<
(
const const_iterator& iter
) const
inline bool Foam::UPtrList<T>::const_iterator::
operator!=(const const_iterator& iter) const noexcept
{
return ptr_ != iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::
operator<(const const_iterator& iter) const noexcept
{
return ptr_ < iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::operator>
(
const const_iterator& iter
) const
inline bool Foam::UPtrList<T>::const_iterator::
operator>(const const_iterator& iter) const noexcept
{
return ptr_ > iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::operator<=
(
const const_iterator& iter
) const
inline bool Foam::UPtrList<T>::const_iterator::
operator<=(const const_iterator& iter) const noexcept
{
return ptr_ <= iter.ptr_;
}
template<class T>
inline bool Foam::UPtrList<T>::const_iterator::operator>=
(
const const_iterator& iter
) const
inline bool Foam::UPtrList<T>::const_iterator::
operator>=(const const_iterator& iter) const noexcept
{
return ptr_ >= iter.ptr_;
}
@ -611,7 +595,7 @@ inline bool Foam::UPtrList<T>::const_iterator::operator>=
template<class T>
inline typename Foam::UPtrList<T>::iterator
Foam::UPtrList<T>::begin()
Foam::UPtrList<T>::begin() noexcept
{
return ptrs_.begin();
}
@ -619,7 +603,7 @@ Foam::UPtrList<T>::begin()
template<class T>
inline typename Foam::UPtrList<T>::iterator
Foam::UPtrList<T>::end()
Foam::UPtrList<T>::end() noexcept
{
return ptrs_.end();
}
@ -627,7 +611,7 @@ Foam::UPtrList<T>::end()
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::cbegin() const
Foam::UPtrList<T>::cbegin() const noexcept
{
return ptrs_.cbegin();
}
@ -635,7 +619,7 @@ Foam::UPtrList<T>::cbegin() const
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::cend() const
Foam::UPtrList<T>::cend() const noexcept
{
return ptrs_.cend();
}
@ -643,7 +627,7 @@ Foam::UPtrList<T>::cend() const
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::begin() const
Foam::UPtrList<T>::begin() const noexcept
{
return ptrs_.begin();
}
@ -651,7 +635,7 @@ Foam::UPtrList<T>::begin() const
template<class T>
inline typename Foam::UPtrList<T>::const_iterator
Foam::UPtrList<T>::end() const
Foam::UPtrList<T>::end() const noexcept
{
return ptrs_.end();
}

View File

@ -460,6 +460,20 @@ Foam::scalar Foam::Matrix<Form, Type>::norm(const bool noSqrt) const
}
template<class Form, class Type>
std::streamsize Foam::Matrix<Form, Type>::byteSize() const
{
if (!is_contiguous<Type>::value)
{
FatalErrorInFunction
<< "Invalid for non-contiguous data types"
<< abort(FatalError);
}
return mRows_*nCols_*sizeof(Type);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Form, class Type>

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -123,8 +123,8 @@ public:
// Constructors
//- Construct null
inline Matrix();
//- Default construct (empty matrix)
inline Matrix() noexcept;
//- Construct given number of rows/columns
Matrix(const label m, const label n);
@ -204,6 +204,9 @@ public:
//- be used to address into Matrix contents
inline Type* data() noexcept;
//- The number of bytes stored by the Matrix data for contiguous types
std::streamsize byteSize() const;
//- Return const pointer to data in the specified row
// Subscript checking only with FULLDEBUG
inline const Type* rowData(const label irow) const;
@ -444,25 +447,25 @@ public:
// Random Access Iterator (non-const)
//- Return an iterator to begin traversing a Matrix
inline iterator begin();
inline iterator begin() noexcept;
//- Return an iterator to end traversing a Matrix
inline iterator end();
inline iterator end() noexcept;
// Random Access Iterator (const)
//- Return const_iterator to begin traversing a constant Matrix
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- Return const_iterator to end traversing a constant Matrix
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- Return const_iterator to begin traversing a constant Matrix
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- Return const_iterator to end traversing a constant Matrix
inline const_iterator end() const;
inline const_iterator end() const noexcept;
// IO

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,7 +45,7 @@ inline void Foam::Matrix<Form, Type>::doAlloc()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Form, class Type>
inline Foam::Matrix<Form, Type>::Matrix()
inline Foam::Matrix<Form, Type>::Matrix() noexcept
:
mRows_(0),
nCols_(0),
@ -510,7 +510,7 @@ inline Foam::tmp<Foam::Field<Type>> Foam::Matrix<Form, Type>::Tmul
template<class Form, class Type>
inline typename Foam::Matrix<Form, Type>::iterator
Foam::Matrix<Form, Type>::begin()
Foam::Matrix<Form, Type>::begin() noexcept
{
return v_;
}
@ -518,7 +518,7 @@ Foam::Matrix<Form, Type>::begin()
template<class Form, class Type>
inline typename Foam::Matrix<Form, Type>::iterator
Foam::Matrix<Form, Type>::end()
Foam::Matrix<Form, Type>::end() noexcept
{
return v_ + (mRows_ * nCols_);
}
@ -526,7 +526,7 @@ Foam::Matrix<Form, Type>::end()
template<class Form, class Type>
inline typename Foam::Matrix<Form, Type>::const_iterator
Foam::Matrix<Form, Type>::cbegin() const
Foam::Matrix<Form, Type>::cbegin() const noexcept
{
return v_;
}
@ -534,7 +534,7 @@ Foam::Matrix<Form, Type>::cbegin() const
template<class Form, class Type>
inline typename Foam::Matrix<Form, Type>::const_iterator
Foam::Matrix<Form, Type>::cend() const
Foam::Matrix<Form, Type>::cend() const noexcept
{
return v_ + (mRows_ * nCols_);
}
@ -542,7 +542,7 @@ Foam::Matrix<Form, Type>::cend() const
template<class Form, class Type>
inline typename Foam::Matrix<Form, Type>::const_iterator
Foam::Matrix<Form, Type>::begin() const
Foam::Matrix<Form, Type>::begin() const noexcept
{
return v_;
}
@ -550,7 +550,7 @@ Foam::Matrix<Form, Type>::begin() const
template<class Form, class Type>
inline typename Foam::Matrix<Form, Type>::const_iterator
Foam::Matrix<Form, Type>::end() const
Foam::Matrix<Form, Type>::end() const noexcept
{
return v_ + (mRows_ * nCols_);
}

View File

@ -1265,7 +1265,7 @@ void Foam::syncTools::syncFaceList
(
Pstream::commsTypes::nonBlocking,
procPatch.neighbProcNo(),
reinterpret_cast<char*>(recvInfo.storage().data()),
reinterpret_cast<char*>(recvInfo.data()),
recvInfo.byteSize()
);
}
@ -1300,7 +1300,7 @@ void Foam::syncTools::syncFaceList
(
Pstream::commsTypes::nonBlocking,
procPatch.neighbProcNo(),
reinterpret_cast<const char*>(sendInfo.storage().cdata()),
reinterpret_cast<const char*>(sendInfo.cdata()),
sendInfo.byteSize()
);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -224,25 +224,25 @@ public:
// Random access iterator (non-const)
//- Return an iterator to begin of VectorSpace
inline iterator begin();
inline iterator begin() noexcept;
//- Return an iterator to end of VectorSpace
inline iterator end();
inline iterator end() noexcept;
// Random access iterator (const)
//- Return const_iterator to begin of VectorSpace
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- Return const_iterator to end of VectorSpace
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- Return const_iterator to begin of VectorSpace
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- Return const_iterator to end of VectorSpace
inline const_iterator end() const;
inline const_iterator end() const noexcept;
// IOstream Operators

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -196,42 +196,46 @@ inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cdata() const noexcept
template<class Form, class Cmpt, Foam::direction Ncmpts>
inline Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::begin()
inline Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::begin() noexcept
{
return v_;
}
template<class Form, class Cmpt, Foam::direction Ncmpts>
inline Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::end()
inline Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::end() noexcept
{
return (v_ + Ncmpts);
}
template<class Form, class Cmpt, Foam::direction Ncmpts>
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cbegin() const
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cbegin()
const noexcept
{
return v_;
}
template<class Form, class Cmpt, Foam::direction Ncmpts>
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cend() const
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cend()
const noexcept
{
return (v_ + Ncmpts);
}
template<class Form, class Cmpt, Foam::direction Ncmpts>
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::begin() const
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::begin()
const noexcept
{
return v_;
}
template<class Form, class Cmpt, Foam::direction Ncmpts>
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::end() const
inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::end()
const noexcept
{
return (v_ + Ncmpts);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -295,11 +295,11 @@ public:
inline bool operator!=(const const_iterator& iter) const noexcept;
};
inline const_iterator cbegin() const;
inline const_iterator cend() const;
inline const_iterator cbegin() const noexcept;
inline const_iterator cend() const noexcept;
const_iterator begin() const { return cbegin(); }
const_iterator end() const { return cend(); }
const_iterator begin() const noexcept { return cbegin(); }
const_iterator end() const noexcept { return cend(); }
// Housekeeping

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -230,7 +230,7 @@ inline bool Foam::Enum<EnumType>::const_iterator::operator!=
template<class EnumType>
inline typename Foam::Enum<EnumType>::const_iterator
Foam::Enum<EnumType>::cbegin() const
Foam::Enum<EnumType>::cbegin() const noexcept
{
return typename Enum<EnumType>::const_iterator(this);
}
@ -238,7 +238,7 @@ Foam::Enum<EnumType>::cbegin() const
template<class EnumType>
inline typename Foam::Enum<EnumType>::const_iterator
Foam::Enum<EnumType>::cend() const
Foam::Enum<EnumType>::cend() const noexcept
{
return typename Enum<EnumType>::const_iterator(this, this->size());
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -167,7 +167,7 @@ public:
inline void resize(const IntType n) noexcept;
//- Enforce non-negative size
inline void clampSize();
inline void clampSize() noexcept;
// Search
@ -212,31 +212,31 @@ public:
inline const_iterator at(const IntType i) const;
//- A const_iterator set to the beginning of the range
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- A const_iterator set to the beginning of the range
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- A const_iterator set to 1 beyond the end of the range.
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- A const_iterator set to 1 beyond the end of the range.
inline const_iterator end() const;
inline const_iterator end() const noexcept;
// Bidirectional reverse input iterators (const)
//- A const_reverse_iterator set to 1 before the end of range
inline const_reverse_iterator rbegin() const;
inline const_reverse_iterator rbegin() const noexcept;
//- A const_reverse_iterator set to 1 before the end of range
inline const_reverse_iterator crbegin() const;
inline const_reverse_iterator crbegin() const noexcept;
//- A const_reverse_iterator set to 1 before the begin of range
inline const_reverse_iterator rend() const;
inline const_reverse_iterator rend() const noexcept;
//- A const_reverse_iterator set to 1 before the begin of range
inline const_reverse_iterator crend() const;
inline const_reverse_iterator crend() const noexcept;
// Iterators
@ -280,13 +280,13 @@ public:
inline const_iterator& operator++() noexcept;
//- Postfix increment
inline const_iterator operator++(int);
inline const_iterator operator++(int) noexcept;
//- Prefix decrement
inline const_iterator& operator--() noexcept;
//- Postfix decrement
inline const_iterator operator--(int);
inline const_iterator operator--(int) noexcept;
//- Arbitrary increment
inline const_iterator& operator+=(const IntType n) noexcept;
@ -391,13 +391,13 @@ public:
inline const_reverse_iterator& operator++() noexcept;
//- Postfix increment
inline const_reverse_iterator operator++(int);
inline const_reverse_iterator operator++(int) noexcept;
//- Prefix decrement
inline const_reverse_iterator& operator--() noexcept;
//- Postfix decrement
inline const_reverse_iterator operator--(int);
inline const_reverse_iterator operator--(int) noexcept;
//- Arbitrary increment
inline const_reverse_iterator& operator+=(const IntType n) noexcept;

View File

@ -99,7 +99,7 @@ operator++() noexcept
template<class IntType>
inline typename Foam::IntRange<IntType>::const_iterator
Foam::IntRange<IntType>::const_iterator::
operator++(int)
operator++(int) noexcept
{
const_iterator old(*this);
++value_;
@ -120,7 +120,7 @@ operator--() noexcept
template<class IntType>
inline typename Foam::IntRange<IntType>::const_iterator
Foam::IntRange<IntType>::const_iterator::
operator--(int)
operator--(int) noexcept
{
const_iterator old(*this);
--value_;
@ -234,7 +234,7 @@ operator++() noexcept
template<class IntType>
inline typename Foam::IntRange<IntType>::const_reverse_iterator
Foam::IntRange<IntType>::const_reverse_iterator::
operator++(int)
operator++(int) noexcept
{
const_reverse_iterator old(*this);
--value_;
@ -255,7 +255,7 @@ operator--() noexcept
template<class IntType>
inline typename Foam::IntRange<IntType>::const_reverse_iterator
Foam::IntRange<IntType>::const_reverse_iterator::
operator--(int)
operator--(int) noexcept
{
const_reverse_iterator old(*this);
++value_;
@ -340,7 +340,7 @@ Foam::IntRange<IntType>::at(const IntType i) const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_iterator
Foam::IntRange<IntType>::begin() const
Foam::IntRange<IntType>::begin() const noexcept
{
return const_iterator(start_);
}
@ -348,7 +348,7 @@ Foam::IntRange<IntType>::begin() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_iterator
Foam::IntRange<IntType>::cbegin() const
Foam::IntRange<IntType>::cbegin() const noexcept
{
return const_iterator(start_);
}
@ -356,7 +356,7 @@ Foam::IntRange<IntType>::cbegin() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_iterator
Foam::IntRange<IntType>::end() const
Foam::IntRange<IntType>::end() const noexcept
{
return const_iterator(start_ + size_);
}
@ -364,7 +364,7 @@ Foam::IntRange<IntType>::end() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_iterator
Foam::IntRange<IntType>::cend() const
Foam::IntRange<IntType>::cend() const noexcept
{
return const_iterator(start_ + size_);
}
@ -372,7 +372,7 @@ Foam::IntRange<IntType>::cend() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_reverse_iterator
Foam::IntRange<IntType>::rbegin() const
Foam::IntRange<IntType>::rbegin() const noexcept
{
return const_reverse_iterator(start_ + (size_-1));
}
@ -380,7 +380,7 @@ Foam::IntRange<IntType>::rbegin() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_reverse_iterator
Foam::IntRange<IntType>::crbegin() const
Foam::IntRange<IntType>::crbegin() const noexcept
{
return const_reverse_iterator(start_ + (size_-1));
}
@ -388,7 +388,7 @@ Foam::IntRange<IntType>::crbegin() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_reverse_iterator
Foam::IntRange<IntType>::rend() const
Foam::IntRange<IntType>::rend() const noexcept
{
return const_reverse_iterator(start_ - 1);
}
@ -396,7 +396,7 @@ Foam::IntRange<IntType>::rend() const
template<class IntType>
inline typename Foam::IntRange<IntType>::const_reverse_iterator
Foam::IntRange<IntType>::crend() const
Foam::IntRange<IntType>::crend() const noexcept
{
return const_reverse_iterator(start_ - 1);
}
@ -508,7 +508,7 @@ inline void Foam::IntRange<IntType>::resize(const IntType n) noexcept
template<class IntType>
inline void Foam::IntRange<IntType>::clampSize()
inline void Foam::IntRange<IntType>::clampSize() noexcept
{
if (size_ < 0) size_ = 0;
}

View File

@ -155,16 +155,16 @@ public:
//- A const_iterator set to the beginning of the list
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- A const_iterator set to beyond the end of the list
inline const const_iterator cend() const;
inline const const_iterator cend() const noexcept;
//- A const_iterator set to the beginning of the list
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- A const_iterator set to beyond the end of the list
inline const const_iterator end() const;
inline const const_iterator end() const noexcept;
// IOstream Operators

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -110,28 +110,28 @@ operator!=
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::labelRanges::const_iterator
Foam::labelRanges::cbegin() const
Foam::labelRanges::cbegin() const noexcept
{
return const_iterator(this);
}
inline const Foam::labelRanges::const_iterator
Foam::labelRanges::cend() const
Foam::labelRanges::cend() const noexcept
{
return const_iterator(this, this->size());
}
inline Foam::labelRanges::const_iterator
Foam::labelRanges::begin() const
Foam::labelRanges::begin() const noexcept
{
return const_iterator(this);
}
inline const Foam::labelRanges::const_iterator
Foam::labelRanges::end() const
Foam::labelRanges::end() const noexcept
{
return const_iterator(this, this->size());
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -179,28 +179,28 @@ public:
inline const_iterator at(const label i) const;
//- A const_iterator set to the beginning of the range
inline const_iterator begin() const;
inline const_iterator begin() const noexcept;
//- A const_iterator set to the beginning of the range
inline const_iterator cbegin() const;
inline const_iterator cbegin() const noexcept;
//- A const_iterator set to 1 beyond the end of the range.
inline const_iterator cend() const;
inline const_iterator cend() const noexcept;
//- A const_iterator set to 1 beyond the end of the range.
inline const_iterator end() const;
inline const_iterator end() const noexcept;
//- A const_reverse_iterator set to 1 before the end of range
inline const_reverse_iterator rbegin() const;
inline const_reverse_iterator rbegin() const noexcept;
//- A const_reverse_iterator set to 1 before the end of range
inline const_reverse_iterator crbegin() const;
inline const_reverse_iterator crbegin() const noexcept;
//- A const_reverse_iterator set to 1 before the begin of range
inline const_reverse_iterator rend() const;
inline const_reverse_iterator rend() const noexcept;
//- A const_reverse_iterator set to 1 before the begin of range
inline const_reverse_iterator crend() const;
inline const_reverse_iterator crend() const noexcept;
// Iterators

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -314,56 +314,56 @@ Foam::sliceRange::at(const label i) const
inline Foam::sliceRange::const_iterator
Foam::sliceRange::begin() const
Foam::sliceRange::begin() const noexcept
{
return const_iterator(start_, stride_);
}
inline Foam::sliceRange::const_iterator
Foam::sliceRange::cbegin() const
Foam::sliceRange::cbegin() const noexcept
{
return const_iterator(start_, stride_);
}
inline Foam::sliceRange::const_iterator
Foam::sliceRange::end() const
Foam::sliceRange::end() const noexcept
{
return const_iterator(start_ + size_*stride_, stride_);
}
inline Foam::sliceRange::const_iterator
Foam::sliceRange::cend() const
Foam::sliceRange::cend() const noexcept
{
return const_iterator(start_ + size_*stride_, stride_);
}
inline Foam::sliceRange::const_reverse_iterator
Foam::sliceRange::rbegin() const
Foam::sliceRange::rbegin() const noexcept
{
return const_reverse_iterator(start_ + (size_-1)*stride_, stride_);
}
inline Foam::sliceRange::const_reverse_iterator
Foam::sliceRange::crbegin() const
Foam::sliceRange::crbegin() const noexcept
{
return const_reverse_iterator(start_ + (size_-1)*stride_, stride_);
}
inline Foam::sliceRange::const_reverse_iterator
Foam::sliceRange::rend() const
Foam::sliceRange::rend() const noexcept
{
return const_reverse_iterator(start_ - stride_, stride_);
}
inline Foam::sliceRange::const_reverse_iterator
Foam::sliceRange::crend() const
Foam::sliceRange::crend() const noexcept
{
return const_reverse_iterator(start_ - stride_, stride_);
}