blob: 9e4014237804b676cdb8d796d694cfd9c3cebf0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
*
* Copyright (c) 2002
* John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_match.hpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Iterator traits for selecting an iterator type as
* an integral constant expression.
*/
#ifndef BOOST_REGEX_ITERATOR_CATEGORY_HPP
#define BOOST_REGEX_ITERATOR_CATEGORY_HPP
#include <iterator>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_pointer.hpp>
namespace boost{
namespace detail{
template <class I>
struct is_random_imp
{
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
private:
typedef typename std::iterator_traits<I>::iterator_category cat;
public:
BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
#else
BOOST_STATIC_CONSTANT(bool, value = false);
#endif
};
template <class I>
struct is_random_pointer_imp
{
BOOST_STATIC_CONSTANT(bool, value = true);
};
template <bool is_pointer_type>
struct is_random_imp_selector
{
template <class I>
struct rebind
{
typedef is_random_imp<I> type;
};
};
template <>
struct is_random_imp_selector<true>
{
template <class I>
struct rebind
{
typedef is_random_pointer_imp<I> type;
};
};
}
template <class I>
struct is_random_access_iterator
{
private:
typedef detail::is_random_imp_selector< ::boost::is_pointer<I>::value> selector;
typedef typename selector::template rebind<I> bound_type;
typedef typename bound_type::type answer;
public:
BOOST_STATIC_CONSTANT(bool, value = answer::value);
};
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
template <class I>
const bool is_random_access_iterator<I>::value;
#endif
}
#endif
|