8254880: ZGC: Let ZList iterators be alias templates

Reviewed-by: ayang, kbarrett, tschatzl
This commit is contained in:
Per Liden 2020-10-19 07:11:40 +00:00
parent 011dd0d8fa
commit 98a395a39e
2 changed files with 3 additions and 33 deletions

View File

@ -111,26 +111,8 @@ public:
bool next(T** elem);
};
// Iterator types
#define ZLIST_FORWARD true
#define ZLIST_REVERSE false
template <typename T>
class ZListIterator : public ZListIteratorImpl<T, ZLIST_FORWARD> {
public:
ZListIterator(const ZList<T>* list);
};
template <typename T>
class ZListReverseIterator : public ZListIteratorImpl<T, ZLIST_REVERSE> {
public:
ZListReverseIterator(const ZList<T>* list);
};
template <typename T>
class ZListRemoveIterator : public ZListRemoveIteratorImpl<T, ZLIST_FORWARD> {
public:
ZListRemoveIterator(ZList<T>* list);
};
template <typename T> using ZListIterator = ZListIteratorImpl<T, true /* Forward */>;
template <typename T> using ZListReverseIterator = ZListIteratorImpl<T, false /* Forward */>;
template <typename T> using ZListRemoveIterator = ZListRemoveIteratorImpl<T, true /* Forward */>;
#endif // SHARE_GC_Z_ZLIST_HPP

View File

@ -232,16 +232,4 @@ inline bool ZListRemoveIteratorImpl<T, Forward>::next(T** elem) {
return *elem != NULL;
}
template <typename T>
inline ZListIterator<T>::ZListIterator(const ZList<T>* list) :
ZListIteratorImpl<T, ZLIST_FORWARD>(list) {}
template <typename T>
inline ZListReverseIterator<T>::ZListReverseIterator(const ZList<T>* list) :
ZListIteratorImpl<T, ZLIST_REVERSE>(list) {}
template <typename T>
inline ZListRemoveIterator<T>::ZListRemoveIterator(ZList<T>* list) :
ZListRemoveIteratorImpl<T, ZLIST_FORWARD>(list) {}
#endif // SHARE_GC_Z_ZLIST_INLINE_HPP