From a1cb4737b04a92f57b1b9dcd8a24c68db5035401 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 24 Jul 2002 20:44:01 +0000 Subject: [PATCH] Changes to make it GCC 3.1 compatible git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3052 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/Support/ilist | 23 ++++++++++++++++++++--- include/llvm/ADT/ilist | 23 ++++++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/include/Support/ilist b/include/Support/ilist index 7e666c6d97f..09c951c2572 100644 --- a/include/Support/ilist +++ b/include/Support/ilist @@ -12,7 +12,7 @@ // The ilist class itself, should be a plug in replacement for list, assuming // that the nodes contain next/prev pointers. This list replacement does not // provides a constant time size() method, so be careful to use empty() when you -// really want to know if I'm empty. +// really want to know if it's empty. // // The ilist class is implemented by allocating a 'tail' node when the list is // created (using ilist_traits<>::createEndMarker()). This tail node is @@ -33,6 +33,7 @@ #include #include +#include template class iplist; template class ilist_iterator; @@ -69,8 +70,18 @@ struct ilist_traits : public ilist_traits {}; // ilist_iterator - Iterator for intrusive list. // template -class ilist_iterator : public std::bidirectional_iterator { +class ilist_iterator +#if __GNUC__ == 3 + : public std::iterator { + typedef std::iterator super; +#else + : public std::bidirectional_iterator { + typedef std::bidirectional_iterator super; +#endif typedef ilist_traits Traits; + + typedef typename super::pointer pointer; + typedef typename super::reference reference; pointer NodePtr; public: typedef size_t size_type; @@ -301,8 +312,12 @@ public: // size_type size() const { +#if __GNUC__ == 3 + size_type Result = std::distance(begin(), end()); +#else size_type Result = 0; std::distance(begin(), end(), Result); +#endif return Result; } @@ -404,6 +419,9 @@ public: template struct ilist : public iplist { + typedef typename iplist::size_type size_type; + typedef typename iplist::iterator iterator; + ilist() {} ilist(const ilist &right) { insert(begin(), right.begin(), right.end()); @@ -478,7 +496,6 @@ struct ilist : public iplist { insert(end(), newsize - len, val); } void resize(size_type newsize) { resize(newsize, NodeTy()); } - }; namespace std { diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist index 7e666c6d97f..09c951c2572 100644 --- a/include/llvm/ADT/ilist +++ b/include/llvm/ADT/ilist @@ -12,7 +12,7 @@ // The ilist class itself, should be a plug in replacement for list, assuming // that the nodes contain next/prev pointers. This list replacement does not // provides a constant time size() method, so be careful to use empty() when you -// really want to know if I'm empty. +// really want to know if it's empty. // // The ilist class is implemented by allocating a 'tail' node when the list is // created (using ilist_traits<>::createEndMarker()). This tail node is @@ -33,6 +33,7 @@ #include #include +#include template class iplist; template class ilist_iterator; @@ -69,8 +70,18 @@ struct ilist_traits : public ilist_traits {}; // ilist_iterator - Iterator for intrusive list. // template -class ilist_iterator : public std::bidirectional_iterator { +class ilist_iterator +#if __GNUC__ == 3 + : public std::iterator { + typedef std::iterator super; +#else + : public std::bidirectional_iterator { + typedef std::bidirectional_iterator super; +#endif typedef ilist_traits Traits; + + typedef typename super::pointer pointer; + typedef typename super::reference reference; pointer NodePtr; public: typedef size_t size_type; @@ -301,8 +312,12 @@ public: // size_type size() const { +#if __GNUC__ == 3 + size_type Result = std::distance(begin(), end()); +#else size_type Result = 0; std::distance(begin(), end(), Result); +#endif return Result; } @@ -404,6 +419,9 @@ public: template struct ilist : public iplist { + typedef typename iplist::size_type size_type; + typedef typename iplist::iterator iterator; + ilist() {} ilist(const ilist &right) { insert(begin(), right.begin(), right.end()); @@ -478,7 +496,6 @@ struct ilist : public iplist { insert(end(), newsize - len, val); } void resize(size_type newsize) { resize(newsize, NodeTy()); } - }; namespace std {