8328997: Remove unnecessary template parameter lists in GrowableArray
Reviewed-by: iwalulya, epeter
This commit is contained in:
parent
5cddc2de49
commit
3d2283800a
@ -117,13 +117,13 @@ class GrowableArrayView : public GrowableArrayBase {
|
|||||||
protected:
|
protected:
|
||||||
E* _data; // data array
|
E* _data; // data array
|
||||||
|
|
||||||
GrowableArrayView<E>(E* data, int capacity, int initial_len) :
|
GrowableArrayView(E* data, int capacity, int initial_len) :
|
||||||
GrowableArrayBase(capacity, initial_len), _data(data) {}
|
GrowableArrayBase(capacity, initial_len), _data(data) {}
|
||||||
|
|
||||||
~GrowableArrayView() {}
|
~GrowableArrayView() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool operator==(const GrowableArrayView<E>& rhs) const {
|
bool operator==(const GrowableArrayView& rhs) const {
|
||||||
if (_len != rhs._len)
|
if (_len != rhs._len)
|
||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < _len; i++) {
|
for (int i = 0; i < _len; i++) {
|
||||||
@ -134,7 +134,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const GrowableArrayView<E>& rhs) const {
|
bool operator!=(const GrowableArrayView& rhs) const {
|
||||||
return !(*this == rhs);
|
return !(*this == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ template <typename E>
|
|||||||
class GrowableArrayFromArray : public GrowableArrayView<E> {
|
class GrowableArrayFromArray : public GrowableArrayView<E> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GrowableArrayFromArray<E>(E* data, int len) :
|
GrowableArrayFromArray(E* data, int len) :
|
||||||
GrowableArrayView<E>(data, len, len) {}
|
GrowableArrayView<E>(data, len, len) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ public:
|
|||||||
return this->at(location);
|
return this->at(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(GrowableArrayWithAllocator<E, Derived>* other) {
|
void swap(GrowableArrayWithAllocator* other) {
|
||||||
::swap(this->_data, other->_data);
|
::swap(this->_data, other->_data);
|
||||||
::swap(this->_len, other->_len);
|
::swap(this->_len, other->_len);
|
||||||
::swap(this->_capacity, other->_capacity);
|
::swap(this->_capacity, other->_capacity);
|
||||||
@ -688,8 +688,8 @@ public:
|
|||||||
// See: init_checks.
|
// See: init_checks.
|
||||||
|
|
||||||
template <typename E>
|
template <typename E>
|
||||||
class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E> > {
|
class GrowableArray : public GrowableArrayWithAllocator<E, GrowableArray<E>> {
|
||||||
friend class GrowableArrayWithAllocator<E, GrowableArray<E> >;
|
friend class GrowableArrayWithAllocator<E, GrowableArray>;
|
||||||
friend class GrowableArrayTest;
|
friend class GrowableArrayTest;
|
||||||
|
|
||||||
static E* allocate(int max) {
|
static E* allocate(int max) {
|
||||||
@ -737,7 +737,7 @@ public:
|
|||||||
GrowableArray() : GrowableArray(2 /* initial_capacity */) {}
|
GrowableArray() : GrowableArray(2 /* initial_capacity */) {}
|
||||||
|
|
||||||
explicit GrowableArray(int initial_capacity) :
|
explicit GrowableArray(int initial_capacity) :
|
||||||
GrowableArrayWithAllocator<E, GrowableArray<E> >(
|
GrowableArrayWithAllocator<E, GrowableArray>(
|
||||||
allocate(initial_capacity),
|
allocate(initial_capacity),
|
||||||
initial_capacity),
|
initial_capacity),
|
||||||
_metadata() {
|
_metadata() {
|
||||||
@ -745,7 +745,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrowableArray(int initial_capacity, MEMFLAGS memflags) :
|
GrowableArray(int initial_capacity, MEMFLAGS memflags) :
|
||||||
GrowableArrayWithAllocator<E, GrowableArray<E> >(
|
GrowableArrayWithAllocator<E, GrowableArray>(
|
||||||
allocate(initial_capacity, memflags),
|
allocate(initial_capacity, memflags),
|
||||||
initial_capacity),
|
initial_capacity),
|
||||||
_metadata(memflags) {
|
_metadata(memflags) {
|
||||||
@ -753,7 +753,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrowableArray(int initial_capacity, int initial_len, const E& filler) :
|
GrowableArray(int initial_capacity, int initial_len, const E& filler) :
|
||||||
GrowableArrayWithAllocator<E, GrowableArray<E> >(
|
GrowableArrayWithAllocator<E, GrowableArray>(
|
||||||
allocate(initial_capacity),
|
allocate(initial_capacity),
|
||||||
initial_capacity, initial_len, filler),
|
initial_capacity, initial_len, filler),
|
||||||
_metadata() {
|
_metadata() {
|
||||||
@ -761,7 +761,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrowableArray(int initial_capacity, int initial_len, const E& filler, MEMFLAGS memflags) :
|
GrowableArray(int initial_capacity, int initial_len, const E& filler, MEMFLAGS memflags) :
|
||||||
GrowableArrayWithAllocator<E, GrowableArray<E> >(
|
GrowableArrayWithAllocator<E, GrowableArray>(
|
||||||
allocate(initial_capacity, memflags),
|
allocate(initial_capacity, memflags),
|
||||||
initial_capacity, initial_len, filler),
|
initial_capacity, initial_len, filler),
|
||||||
_metadata(memflags) {
|
_metadata(memflags) {
|
||||||
@ -769,7 +769,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrowableArray(Arena* arena, int initial_capacity, int initial_len, const E& filler) :
|
GrowableArray(Arena* arena, int initial_capacity, int initial_len, const E& filler) :
|
||||||
GrowableArrayWithAllocator<E, GrowableArray<E> >(
|
GrowableArrayWithAllocator<E, GrowableArray>(
|
||||||
allocate(initial_capacity, arena),
|
allocate(initial_capacity, arena),
|
||||||
initial_capacity, initial_len, filler),
|
initial_capacity, initial_len, filler),
|
||||||
_metadata(arena) {
|
_metadata(arena) {
|
||||||
@ -852,15 +852,15 @@ class GrowableArrayIterator : public StackObj {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
GrowableArrayIterator() : _array(nullptr), _position(0) { }
|
GrowableArrayIterator() : _array(nullptr), _position(0) { }
|
||||||
GrowableArrayIterator<E>& operator++() { ++_position; return *this; }
|
GrowableArrayIterator& operator++() { ++_position; return *this; }
|
||||||
E operator*() { return _array->at(_position); }
|
E operator*() { return _array->at(_position); }
|
||||||
|
|
||||||
bool operator==(const GrowableArrayIterator<E>& rhs) {
|
bool operator==(const GrowableArrayIterator& rhs) {
|
||||||
assert(_array == rhs._array, "iterator belongs to different array");
|
assert(_array == rhs._array, "iterator belongs to different array");
|
||||||
return _position == rhs._position;
|
return _position == rhs._position;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const GrowableArrayIterator<E>& rhs) {
|
bool operator!=(const GrowableArrayIterator& rhs) {
|
||||||
assert(_array == rhs._array, "iterator belongs to different array");
|
assert(_array == rhs._array, "iterator belongs to different array");
|
||||||
return _position != rhs._position;
|
return _position != rhs._position;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user