3 * Copyright (c) 1998-2002
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)
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.
19 #ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
20 #define BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
24 #pragma warning(disable: 4103)
26 #ifdef BOOST_HAS_ABI_HEADERS
27 # include BOOST_ABI_PREFIX
34 namespace BOOST_REGEX_DETAIL_NS{
36 #if defined(BOOST_NO_STD_ITERATOR_TRAITS)
39 struct regex_iterator_traits
41 typedef typename T::iterator_category iterator_category;
42 typedef typename T::value_type value_type;
43 #if !defined(BOOST_NO_STD_ITERATOR)
44 typedef typename T::difference_type difference_type;
45 typedef typename T::pointer pointer;
46 typedef typename T::reference reference;
48 typedef std::ptrdiff_t difference_type;
49 typedef value_type* pointer;
50 typedef value_type& reference;
55 struct pointer_iterator_traits
57 typedef std::ptrdiff_t difference_type;
61 typedef std::random_access_iterator_tag iterator_category;
64 struct const_pointer_iterator_traits
66 typedef std::ptrdiff_t difference_type;
68 typedef const T* pointer;
69 typedef const T& reference;
70 typedef std::random_access_iterator_tag iterator_category;
74 struct regex_iterator_traits<char*> : pointer_iterator_traits<char>{};
76 struct regex_iterator_traits<const char*> : const_pointer_iterator_traits<char>{};
78 struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
80 struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
82 // the follwoing are needed for ICU support:
85 struct regex_iterator_traits<unsigned char*> : pointer_iterator_traits<char>{};
87 struct regex_iterator_traits<const unsigned char*> : const_pointer_iterator_traits<char>{};
89 struct regex_iterator_traits<int*> : pointer_iterator_traits<int>{};
91 struct regex_iterator_traits<const int*> : const_pointer_iterator_traits<int>{};
93 #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
95 struct regex_iterator_traits<unsigned short*> : pointer_iterator_traits<unsigned short>{};
97 struct regex_iterator_traits<const unsigned short*> : const_pointer_iterator_traits<unsigned short>{};
100 #if defined(__SGI_STL_PORT) && defined(__STL_DEBUG)
102 struct regex_iterator_traits<std::string::iterator> : pointer_iterator_traits<char>{};
104 struct regex_iterator_traits<std::string::const_iterator> : const_pointer_iterator_traits<char>{};
105 #ifndef BOOST_NO_STD_WSTRING
107 struct regex_iterator_traits<std::wstring::iterator> : pointer_iterator_traits<wchar_t>{};
109 struct regex_iterator_traits<std::wstring::const_iterator> : const_pointer_iterator_traits<wchar_t>{};
110 #endif // BOOST_NO_WSTRING
116 struct regex_iterator_traits : public std::iterator_traits<T> {};
120 } // namespace BOOST_REGEX_DETAIL_NS
124 #pragma warning(push)
125 #pragma warning(disable: 4103)
127 #ifdef BOOST_HAS_ABI_HEADERS
128 # include BOOST_ABI_SUFFIX