]> git.lyx.org Git - lyx.git/blob - boost/boost/regex/v4/iterator_traits.hpp
update to boost 1.34
[lyx.git] / boost / boost / regex / v4 / iterator_traits.hpp
1 /*
2  *
3  * Copyright (c) 1998-2002
4  * John Maddock
5  *
6  * Use, modification and distribution are subject to the 
7  * Boost Software License, Version 1.0. (See accompanying file 
8  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9  *
10  */
11
12  /*
13   *   LOCATION:    see http://www.boost.org for most recent version.
14   *   FILE         iterator_traits.cpp
15   *   VERSION      see <boost/version.hpp>
16   *   DESCRIPTION: Declares iterator traits workarounds.
17   */
18
19 #ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
20 #define BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
21
22 #ifdef BOOST_HAS_ABI_HEADERS
23 #  include BOOST_ABI_PREFIX
24 #endif
25
26 namespace boost{
27 namespace re_detail{
28
29 #if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
30
31 template <class T>
32 struct regex_iterator_traits 
33 {
34   typedef typename T::iterator_category iterator_category;
35   typedef typename T::value_type        value_type;
36 #if !defined(BOOST_NO_STD_ITERATOR)
37   typedef typename T::difference_type   difference_type;
38   typedef typename T::pointer           pointer;
39   typedef typename T::reference         reference;
40 #else
41   typedef std::ptrdiff_t                difference_type;
42   typedef value_type*                   pointer;
43   typedef value_type&                   reference;
44 #endif
45 };
46
47 template <class T>
48 struct pointer_iterator_traits
49 {
50    typedef std::ptrdiff_t difference_type;
51    typedef T value_type;
52    typedef T* pointer;
53    typedef T& reference;
54    typedef std::random_access_iterator_tag iterator_category;
55 };
56 template <class T>
57 struct const_pointer_iterator_traits
58 {
59    typedef std::ptrdiff_t difference_type;
60    typedef T value_type;
61    typedef const T* pointer;
62    typedef const T& reference;
63    typedef std::random_access_iterator_tag iterator_category;
64 };
65
66 template<>
67 struct regex_iterator_traits<char*> : pointer_iterator_traits<char>{};
68 template<>
69 struct regex_iterator_traits<const char*> : const_pointer_iterator_traits<char>{};
70 template<>
71 struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
72 template<>
73 struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
74 //
75 // the follwoing are needed for ICU support:
76 //
77 template<>
78 struct regex_iterator_traits<unsigned char*> : pointer_iterator_traits<char>{};
79 template<>
80 struct regex_iterator_traits<const unsigned char*> : const_pointer_iterator_traits<char>{};
81 template<>
82 struct regex_iterator_traits<int*> : pointer_iterator_traits<int>{};
83 template<>
84 struct regex_iterator_traits<const int*> : const_pointer_iterator_traits<int>{};
85
86 #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
87 template<>
88 struct regex_iterator_traits<unsigned short*> : pointer_iterator_traits<unsigned short>{};
89 template<>
90 struct regex_iterator_traits<const unsigned short*> : const_pointer_iterator_traits<unsigned short>{};
91 #endif
92
93 #if defined(__SGI_STL_PORT) && defined(__STL_DEBUG)
94 template<>
95 struct regex_iterator_traits<std::string::iterator> : pointer_iterator_traits<char>{};
96 template<>
97 struct regex_iterator_traits<std::string::const_iterator> : const_pointer_iterator_traits<char>{};
98 #ifndef BOOST_NO_STD_WSTRING
99 template<>
100 struct regex_iterator_traits<std::wstring::iterator> : pointer_iterator_traits<wchar_t>{};
101 template<>
102 struct regex_iterator_traits<std::wstring::const_iterator> : const_pointer_iterator_traits<wchar_t>{};
103 #endif // BOOST_NO_WSTRING
104 #endif // stport
105
106 #else
107
108 template <class T>
109 struct regex_iterator_traits : public std::iterator_traits<T> {};
110
111 #endif
112
113 } // namespace re_detail
114 } // namespace boost
115
116 #ifdef BOOST_HAS_ABI_HEADERS
117 #  include BOOST_ABI_SUFFIX
118 #endif
119
120 #endif
121