Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:08:36

0001 /*
0002  *
0003  * Copyright (c) 2002
0004  * John Maddock
0005  *
0006  * Use, modification and distribution are subject to the 
0007  * Boost Software License, Version 1.0. (See accompanying file 
0008  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009  *
0010  */
0011 
0012  /*
0013   *   LOCATION:    see http://www.boost.org for most recent version.
0014   *   FILE         regex_match.hpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Iterator traits for selecting an iterator type as
0017   *                an integral constant expression.
0018   */
0019 
0020 
0021 #ifndef BOOST_REGEX_ITERATOR_CATEGORY_HPP
0022 #define BOOST_REGEX_ITERATOR_CATEGORY_HPP
0023 
0024 #include <iterator>
0025 #include <type_traits>
0026 
0027 namespace boost{
0028 namespace detail{
0029 
0030 template <class I>
0031 struct is_random_imp
0032 {
0033 private:
0034    typedef typename std::iterator_traits<I>::iterator_category cat;
0035 public:
0036    static const bool value = (std::is_convertible<cat*, std::random_access_iterator_tag*>::value);
0037 };
0038 
0039 template <class I>
0040 struct is_random_pointer_imp
0041 {
0042    static const bool value = true;
0043 };
0044 
0045 template <bool is_pointer_type>
0046 struct is_random_imp_selector
0047 {
0048    template <class I>
0049    struct rebind
0050    {
0051       typedef is_random_imp<I> type;
0052    };
0053 };
0054 
0055 template <>
0056 struct is_random_imp_selector<true>
0057 {
0058    template <class I>
0059    struct rebind
0060    {
0061       typedef is_random_pointer_imp<I> type;
0062    };
0063 };
0064 
0065 }
0066 
0067 template <class I>
0068 struct is_random_access_iterator
0069 {
0070 private:
0071    typedef detail::is_random_imp_selector< std::is_pointer<I>::value> selector;
0072    typedef typename selector::template rebind<I> bound_type;
0073    typedef typename bound_type::type answer;
0074 public:
0075    static const bool value = answer::value;
0076 };
0077 
0078 template <class I>
0079 const bool is_random_access_iterator<I>::value;
0080 
0081 }
0082 
0083 #endif
0084