//===-- Support/iterator - "Portable" wrapper around <iterator> -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file provides a wrapper around the mysterious <iterator> header file.
// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other
#include <iterator>
+//////////////////////////////////////////////////////////////////////////////
+// If the bidirectional iterator is not defined, attempt to define it using
+// the C++ standard iterator.
+//////////////////////////////////////////////////////////////////////////////
+#ifndef HAVE_BI_ITERATOR
#ifdef HAVE_STD_ITERATOR
// Define stupid wrappers around std::iterator...
: public std::iterator<std::bidirectional_iterator_tag, Ty, PtrDiffTy> {
};
-template<class Ty, class PtrDiffTy>
-struct forward_iterator
- : public std::iterator<std::forward_iterator_tag, Ty, PtrDiffTy> {
-};
+#else
+#error "Need to have standard iterator to define bidirectional iterator!"
+#endif
#else
// Just use bidirectional_iterator directly.
using std::bidirectional_iterator;
+
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// If the forward iterator is not defined, attempt to define it using the
+// C++ standard iterator.
+//////////////////////////////////////////////////////////////////////////////
+#ifndef HAVE_FWD_ITERATOR
+#ifdef HAVE_STD_ITERATOR
+template<class Ty, class PtrDiffTy>
+struct forward_iterator
+ : public std::iterator<std::forward_iterator_tag, Ty, PtrDiffTy> {
+};
+#else
+#error "Need to have standard iterator to define forward iterator!"
+#endif
+#else
+// Just use forward iterator directly.
using std::forward_iterator;
#endif
+
#endif