3 // Copyright Thorsten Ottosen 2003-2004. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
11 #ifndef BOOST_RANGE_DETAIL_DIFFERENCE_TYPE_HPP
12 #define BOOST_RANGE_DETAIL_DIFFERENCE_TYPE_HPP
14 #include <boost/range/detail/common.hpp>
15 #include <boost/iterator/iterator_traits.hpp>
17 //////////////////////////////////////////////////////////////////////////////
18 // missing partial specialization workaround.
19 //////////////////////////////////////////////////////////////////////////////
23 namespace range_detail
25 template< typename T >
26 struct range_difference_type_;
29 struct range_difference_type_<std_container_>
31 template< typename C >
34 typedef BOOST_DEDUCED_TYPENAME C::difference_type type;
39 struct range_difference_type_<std_pair_>
41 template< typename P >
44 typedef BOOST_RANGE_DEDUCED_TYPENAME boost::iterator_difference< BOOST_DEDUCED_TYPENAME P::first_type>::type type;
49 struct range_difference_type_<array_>
51 template< typename A >
54 typedef std::ptrdiff_t type;
59 struct range_difference_type_<char_array_>
61 template< typename A >
64 typedef std::ptrdiff_t type;
69 struct range_difference_type_<char_ptr_>
71 template< typename S >
74 typedef std::ptrdiff_t type;
79 struct range_difference_type_<const_char_ptr_>
81 template< typename S >
84 typedef std::ptrdiff_t type;
89 struct range_difference_type_<wchar_t_ptr_>
91 template< typename S >
94 typedef std::ptrdiff_t type;
99 struct range_difference_type_<const_wchar_t_ptr_>
101 template< typename S >
104 typedef std::ptrdiff_t type;
110 template< typename C >
111 class range_difference
113 typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail::range<C>::type c_type;
115 typedef BOOST_RANGE_DEDUCED_TYPENAME range_detail::range_difference_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type;