systemc: replace the deprecated std::iterator
std::iterator is deprecated in c++17. We can just declare the required types for iterator traits directly without the helper. Change-Id: I789e2c2b13e56cc391527686109df8b779474d09 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/66351 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <exception>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
@@ -259,10 +260,7 @@ class sc_member_access
|
||||
|
||||
template <typename Element,
|
||||
typename AccessPolicy=sc_direct_access<Element> >
|
||||
class sc_vector_iter :
|
||||
public std::iterator<std::random_access_iterator_tag,
|
||||
typename AccessPolicy::Type>,
|
||||
private AccessPolicy
|
||||
class sc_vector_iter : private AccessPolicy
|
||||
{
|
||||
private:
|
||||
typedef Element ElementType;
|
||||
@@ -282,8 +280,6 @@ class sc_vector_iter :
|
||||
template <typename, typename>
|
||||
friend class sc_vector_iter;
|
||||
|
||||
typedef std::iterator<std::random_access_iterator_tag, AccessType>
|
||||
BaseType;
|
||||
typedef sc_vector_iter ThisType;
|
||||
typedef sc_vector<PlainType> VectorType;
|
||||
typedef std::vector<void *> StorageType;
|
||||
@@ -315,9 +311,11 @@ class sc_vector_iter :
|
||||
// Conforms to Random Access Iterator category.
|
||||
// See ISO/IEC 14882:2003(E), 24.1 [lib.iterator.requirements]
|
||||
|
||||
typedef typename BaseType::difference_type difference_type;
|
||||
typedef typename BaseType::reference reference;
|
||||
typedef typename BaseType::pointer pointer;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using value_type = typename AccessPolicy::Type;
|
||||
using reference = typename AccessPolicy::Type &;
|
||||
using pointer = typename AccessPolicy::Type *;
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
|
||||
sc_vector_iter() : Policy(), it_() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user