2323// removed a bunch of slice variants for simplicity...
2424
2525#pragma once
26- #include < assert.h>
27-
2826#include < array>
27+ #include < cassert>
2928#include < vector>
3029
3130namespace ONNX_NAMESPACE {
@@ -43,11 +42,11 @@ namespace ONNX_NAMESPACE {
4342template <typename T>
4443class ArrayRef {
4544 public:
46- typedef const T* iterator ;
47- typedef const T* const_iterator ;
48- typedef size_t size_type;
45+ using iterator = const T*;
46+ using const_iterator = const T*;
47+ using size_type = size_t ;
4948
50- typedef std::reverse_iterator<iterator> reverse_iterator ;
49+ using reverse_iterator = std::reverse_iterator<iterator>;
5150
5251 private:
5352 // / The start of the array, in an external buffer.
@@ -64,6 +63,7 @@ class ArrayRef {
6463 /* implicit*/ ArrayRef() : Data(nullptr ), Length(0 ) {}
6564
6665 // / Construct an ArrayRef from a single element.
66+ // / NOLINTNEXTLINE(google-explicit-constructor)
6767 /* implicit*/ ArrayRef(const T& OneElt) : Data(&OneElt), Length(1 ) {}
6868
6969 // / Construct an ArrayRef from a pointer and length.
@@ -74,14 +74,17 @@ class ArrayRef {
7474
7575 // / Construct an ArrayRef from a std::vector.
7676 template <typename A>
77+ // / NOLINTNEXTLINE(google-explicit-constructor)
7778 /* implicit*/ ArrayRef(const std::vector<T, A>& Vec) : Data(Vec.data()), Length(Vec.size()) {}
7879
7980 // / Construct an ArrayRef from a std::array
8081 template <size_t N>
82+ // / NOLINTNEXTLINE(google-explicit-constructor)
8183 /* implicit*/ constexpr ArrayRef (const std::array<T, N>& Arr) : Data(Arr.data()), Length(N) {}
8284
8385 // / Construct an ArrayRef from a C array.
8486 template <size_t N>
87+ // / NOLINTNEXTLINE(google-explicit-constructor, *array*)
8588 /* implicit*/ constexpr ArrayRef (const T (&Arr)[N]) : Data(Arr), Length(N) {}
8689
8790 // / Construct an ArrayRef from a std::initializer_list.
@@ -170,14 +173,14 @@ class ArrayRef {
170173 // / The declaration here is extra complicated so that "arrayRef = {}"
171174 // / continues to select the move assignment operator.
172175 template <typename U>
173- typename std::enable_if <std::is_same <U, T>::value , ArrayRef<T>>::type & operator =(U&& Temporary) = delete ;
176+ std::enable_if_t <std::is_same_v <U, T>, ArrayRef<T>>& operator =(U&& Temporary) = delete ;
174177
175178 // / Disallow accidental assignment from a temporary.
176179 // /
177180 // / The declaration here is extra complicated so that "arrayRef = {}"
178181 // / continues to select the move assignment operator.
179182 template <typename U>
180- typename std::enable_if <std::is_same <U, T>::value , ArrayRef<T>>::type & operator =(std::initializer_list<U>) = delete ;
183+ std::enable_if_t <std::is_same_v <U, T>, ArrayRef<T>>& operator =(std::initializer_list<U>) = delete ;
181184
182185 // / @}
183186 // / @name Expensive Operations
@@ -189,6 +192,7 @@ class ArrayRef {
189192 // / @}
190193 // / @name Conversion operators
191194 // / @{
195+ // / NOLINTNEXTLINE(google-explicit-constructor)
192196 operator std::vector<T>() const {
193197 return std::vector<T>(Data, Data + Length);
194198 }
0 commit comments