UList,FixedList: Updated reverse_iterators for STL compliance
Resolves bug-report https://bugs.openfoam.org/view.php?id=3534
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,8 +42,6 @@ See also
|
||||
#include "vector.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
#include<list>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -286,7 +286,7 @@ public:
|
||||
// STL reverse_iterator
|
||||
|
||||
//- Reverse iterator for reverse traversal of FixedList
|
||||
typedef T* reverse_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
|
||||
//- Return reverse_iterator to begin reverse traversing the FixedList
|
||||
inline reverse_iterator rbegin();
|
||||
@ -298,7 +298,7 @@ public:
|
||||
// STL const_reverse_iterator
|
||||
|
||||
//- Reverse iterator for reverse traversal of constant FixedList
|
||||
typedef const T* const_reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//- Return const_reverse_iterator to begin reverse traversing FixedList
|
||||
inline const_reverse_iterator crbegin() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -326,12 +326,11 @@ Foam::FixedList<T, Size>::begin()
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::begin() const
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::end()
|
||||
{
|
||||
return v_;
|
||||
return &v_[Size];
|
||||
}
|
||||
|
||||
|
||||
@ -344,13 +343,21 @@ Foam::FixedList<T, Size>::cbegin() const
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
Foam::FixedList<T, Size>::end()
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::cend() const
|
||||
{
|
||||
return &v_[Size];
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::begin() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::end() const
|
||||
@ -360,58 +367,50 @@ Foam::FixedList<T, Size>::end() const
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::cend() const
|
||||
{
|
||||
return &v_[Size];
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
inline typename Foam::FixedList<T, Size>::reverse_iterator
|
||||
Foam::FixedList<T, Size>::rbegin()
|
||||
{
|
||||
return &v_[Size-1];
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::rbegin() const
|
||||
{
|
||||
return &v_[Size-1];
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::crbegin() const
|
||||
{
|
||||
return &v_[Size-1];
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::iterator
|
||||
inline typename Foam::FixedList<T, Size>::reverse_iterator
|
||||
Foam::FixedList<T, Size>::rend()
|
||||
{
|
||||
return &v_[-1];
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
Foam::FixedList<T, Size>::rend() const
|
||||
inline typename Foam::FixedList<T, Size>::const_reverse_iterator
|
||||
Foam::FixedList<T, Size>::crbegin() const
|
||||
{
|
||||
return &v_[-1];
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_iterator
|
||||
inline typename Foam::FixedList<T, Size>::const_reverse_iterator
|
||||
Foam::FixedList<T, Size>::crend() const
|
||||
{
|
||||
return &v_[-1];
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_reverse_iterator
|
||||
Foam::FixedList<T, Size>::rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
|
||||
template<class T, unsigned Size>
|
||||
inline typename Foam::FixedList<T, Size>::const_reverse_iterator
|
||||
Foam::FixedList<T, Size>::rend() const
|
||||
{
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -297,7 +297,7 @@ public:
|
||||
// STL reverse_iterator
|
||||
|
||||
//- Reverse iterator for reverse traversal of UList
|
||||
typedef T* reverse_iterator;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
|
||||
//- Return reverse_iterator to begin reverse traversing the UList
|
||||
inline reverse_iterator rbegin();
|
||||
@ -309,7 +309,7 @@ public:
|
||||
// STL const_reverse_iterator
|
||||
|
||||
//- Reverse iterator for reverse traversal of constant UList
|
||||
typedef const T* const_reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
//- Return const_reverse_iterator to begin reverse traversing the UList
|
||||
inline const_reverse_iterator crbegin() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -218,19 +218,6 @@ Foam::UList<T>::begin()
|
||||
return v_;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::begin() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::cbegin() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::iterator
|
||||
@ -239,13 +226,15 @@ Foam::UList<T>::end()
|
||||
return &v_[size_];
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::end() const
|
||||
Foam::UList<T>::cbegin() const
|
||||
{
|
||||
return &v_[size_];
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::cend() const
|
||||
@ -253,48 +242,71 @@ Foam::UList<T>::cend() const
|
||||
return &v_[size_];
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::iterator
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::begin() const
|
||||
{
|
||||
return v_;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::end() const
|
||||
{
|
||||
return &v_[size_];
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::reverse_iterator
|
||||
Foam::UList<T>::rbegin()
|
||||
{
|
||||
return &v_[size_-1];
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::rbegin() const
|
||||
{
|
||||
return &v_[size_-1];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::crbegin() const
|
||||
{
|
||||
return &v_[size_-1];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::iterator
|
||||
inline typename Foam::UList<T>::reverse_iterator
|
||||
Foam::UList<T>::rend()
|
||||
{
|
||||
return &v_[-1];
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
Foam::UList<T>::rend() const
|
||||
inline typename Foam::UList<T>::const_reverse_iterator
|
||||
Foam::UList<T>::crbegin() const
|
||||
{
|
||||
return &v_[-1];
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_iterator
|
||||
inline typename Foam::UList<T>::const_reverse_iterator
|
||||
Foam::UList<T>::crend() const
|
||||
{
|
||||
return &v_[-1];
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_reverse_iterator
|
||||
Foam::UList<T>::rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline typename Foam::UList<T>::const_reverse_iterator
|
||||
Foam::UList<T>::rend() const
|
||||
{
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::UList<T>::size() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user