[857] | 1 | // Boost.Range library
|
---|
| 2 | //
|
---|
| 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)
|
---|
| 7 | //
|
---|
| 8 | // For more information, see http://www.boost.org/libs/range/
|
---|
| 9 | //
|
---|
| 10 |
|
---|
| 11 | #ifndef BOOST_RANGE_DIFFERENCE_TYPE_HPP
|
---|
| 12 | #define BOOST_RANGE_DIFFERENCE_TYPE_HPP
|
---|
| 13 |
|
---|
| 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
---|
| 15 | # pragma once
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
| 18 | #include <boost/range/config.hpp>
|
---|
| 19 | #include <boost/range/const_iterator.hpp>
|
---|
| 20 | #include <boost/iterator/iterator_traits.hpp>
|
---|
| 21 |
|
---|
| 22 | namespace boost
|
---|
| 23 | {
|
---|
| 24 | template< class T >
|
---|
| 25 | struct range_difference
|
---|
| 26 | {
|
---|
| 27 | typedef BOOST_DEDUCED_TYPENAME iterator_difference<
|
---|
| 28 | BOOST_DEDUCED_TYPENAME range_const_iterator<T>::type >::type
|
---|
| 29 | type;
|
---|
| 30 | };
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | //#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
---|
| 34 | //#include <boost/range/detail/difference_type.hpp>
|
---|
| 35 | //#else
|
---|
| 36 |
|
---|
| 37 | /*
|
---|
| 38 | #include <cstddef>
|
---|
| 39 | #include <utility>
|
---|
| 40 |
|
---|
| 41 | namespace boost
|
---|
| 42 | {
|
---|
| 43 | //////////////////////////////////////////////////////////////////////////
|
---|
| 44 | // default
|
---|
| 45 | //////////////////////////////////////////////////////////////////////////
|
---|
| 46 |
|
---|
| 47 | template< typename C >
|
---|
| 48 | struct range_difference
|
---|
| 49 | {
|
---|
| 50 | typedef BOOST_DEDUCED_TYPENAME C::difference_type type;
|
---|
| 51 | };
|
---|
| 52 |
|
---|
| 53 | //////////////////////////////////////////////////////////////////////////
|
---|
| 54 | // pair
|
---|
| 55 | //////////////////////////////////////////////////////////////////////////
|
---|
| 56 |
|
---|
| 57 | template< typename Iterator >
|
---|
| 58 | struct range_difference< std::pair<Iterator,Iterator> >
|
---|
| 59 | {
|
---|
| 60 | typedef BOOST_DEDUCED_TYPENAME
|
---|
| 61 | iterator_difference<Iterator>::type type;
|
---|
| 62 | };
|
---|
| 63 |
|
---|
| 64 | template< typename Iterator >
|
---|
| 65 | struct range_difference< const std::pair<Iterator,Iterator> >
|
---|
| 66 | {
|
---|
| 67 | typedef BOOST_DEDUCED_TYPENAME
|
---|
| 68 | iterator_difference<Iterator>::type type;
|
---|
| 69 | };
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | //////////////////////////////////////////////////////////////////////////
|
---|
| 73 | // array
|
---|
| 74 | //////////////////////////////////////////////////////////////////////////
|
---|
| 75 |
|
---|
| 76 | template< typename T, std::size_t sz >
|
---|
| 77 | struct range_difference< T[sz] >
|
---|
| 78 | {
|
---|
| 79 | typedef std::ptrdiff_t type;
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 | template< typename T, std::size_t sz >
|
---|
| 83 | struct range_difference< const T[sz] >
|
---|
| 84 | {
|
---|
| 85 | typedef std::ptrdiff_t type;
|
---|
| 86 | };
|
---|
| 87 |
|
---|
| 88 | //////////////////////////////////////////////////////////////////////////
|
---|
| 89 | // string
|
---|
| 90 | //////////////////////////////////////////////////////////////////////////
|
---|
| 91 |
|
---|
| 92 | template<>
|
---|
| 93 | struct range_difference< char* >
|
---|
| 94 | {
|
---|
| 95 | typedef std::ptrdiff_t type;
|
---|
| 96 | };
|
---|
| 97 |
|
---|
| 98 | template<>
|
---|
| 99 | struct range_difference< wchar_t* >
|
---|
| 100 | {
|
---|
| 101 | typedef std::ptrdiff_t type;
|
---|
| 102 | };
|
---|
| 103 |
|
---|
| 104 | template<>
|
---|
| 105 | struct range_difference< const char* >
|
---|
| 106 | {
|
---|
| 107 | typedef std::ptrdiff_t type;
|
---|
| 108 | };
|
---|
| 109 |
|
---|
| 110 | template<>
|
---|
| 111 | struct range_difference< const wchar_t* >
|
---|
| 112 | {
|
---|
| 113 | typedef std::ptrdiff_t type;
|
---|
| 114 | };
|
---|
| 115 |
|
---|
| 116 | template<>
|
---|
| 117 | struct range_difference< char* const >
|
---|
| 118 | {
|
---|
| 119 | typedef std::ptrdiff_t type;
|
---|
| 120 | };
|
---|
| 121 |
|
---|
| 122 | template<>
|
---|
| 123 | struct range_difference< wchar_t* const >
|
---|
| 124 | {
|
---|
| 125 | typedef std::ptrdiff_t type;
|
---|
| 126 | };
|
---|
| 127 |
|
---|
| 128 | template<>
|
---|
| 129 | struct range_difference< const char* const >
|
---|
| 130 | {
|
---|
| 131 | typedef std::ptrdiff_t type;
|
---|
| 132 | };
|
---|
| 133 |
|
---|
| 134 | template<>
|
---|
| 135 | struct range_difference< const wchar_t* const >
|
---|
| 136 | {
|
---|
| 137 | typedef std::ptrdiff_t type;
|
---|
| 138 | };
|
---|
| 139 |
|
---|
| 140 | } // namespace boost
|
---|
| 141 |
|
---|
| 142 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
---|
| 143 | */
|
---|
| 144 |
|
---|
| 145 | #endif
|
---|