LLVM API Documentation

iterator.h

Go to the documentation of this file.
00001 /* include/llvm/ADT/iterator.h.  Generated from iterator.h.in by configure.  */
00002 //==-- llvm/ADT/iterator.h - Portable wrapper around <iterator> --*- C++ -*-==//
00003 // 
00004 //                     The LLVM Compiler Infrastructure
00005 //
00006 // This file is distributed under the University of Illinois Open Source
00007 // License. See LICENSE.TXT for details.
00008 // 
00009 //===----------------------------------------------------------------------===//
00010 //
00011 // This file provides a wrapper around the mysterious <iterator> header file.
00012 // In GCC 2.95.3, the file defines a bidirectional_iterator class (and other
00013 // friends), instead of the standard iterator class.  In GCC 3.1, the
00014 // bidirectional_iterator class got moved out and the new, standards compliant,
00015 // iterator<> class was added.  Because there is nothing that we can do to get
00016 // correct behavior on both compilers, we have this header with #ifdef's.  Gross
00017 // huh?
00018 //
00019 // By #includ'ing this file, you get the contents of <iterator> plus the
00020 // following classes in the global namespace:
00021 //
00022 //   1. bidirectional_iterator
00023 //   2. forward_iterator
00024 //
00025 // The #if directives' expressions are filled in by Autoconf.
00026 //
00027 //===----------------------------------------------------------------------===//
00028 
00029 #ifndef LLVM_ADT_ITERATOR_H
00030 #define LLVM_ADT_ITERATOR_H
00031 
00032 #include <iterator>
00033 
00034 #define HAVE_BI_ITERATOR 0
00035 #define HAVE_STD_ITERATOR 1
00036 #define HAVE_FWD_ITERATOR 0
00037 
00038 #ifdef _MSC_VER
00039 #  define HAVE_BI_ITERATOR 0
00040 #  define HAVE_STD_ITERATOR 1
00041 #  define HAVE_FWD_ITERATOR 0
00042 #endif
00043 
00044 #if !HAVE_BI_ITERATOR
00045 # if HAVE_STD_ITERATOR
00046 /// If the bidirectional iterator is not defined, we attempt to define it in
00047 /// terms of the C++ standard iterator. Otherwise, we import it with a "using"
00048 /// statement.
00049 ///
00050 template<class Ty, class PtrDiffTy>
00051 struct bidirectional_iterator
00052   : public std::iterator<std::bidirectional_iterator_tag, Ty, PtrDiffTy> {
00053 };
00054 # else
00055 #  error "Need to have standard iterator to define bidirectional iterator!"
00056 # endif
00057 #else
00058 using std::bidirectional_iterator;
00059 #endif
00060 
00061 #if !HAVE_FWD_ITERATOR
00062 # if HAVE_STD_ITERATOR
00063 /// If the forward iterator is not defined, attempt to define it in terms of
00064 /// the C++ standard iterator. Otherwise, we import it with a "using" statement.
00065 ///
00066 template<class Ty, class PtrDiffTy>
00067 struct forward_iterator
00068   : public std::iterator<std::forward_iterator_tag, Ty, PtrDiffTy> {
00069 };
00070 # else
00071 #  error "Need to have standard iterator to define forward iterator!"
00072 # endif
00073 #else
00074 using std::forward_iterator;
00075 #endif
00076 
00077 #endif // LLVM_ADT_ITERATOR_H



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.