Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:17

0001 // Boost.Range library
0002 //
0003 //  Copyright Neil Groves 2010. Use, modification and
0004 //  distribution is subject to the Boost Software License, Version
0005 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // For more information, see http://www.boost.org/libs/range/
0009 //
0010 // Acknowledgments:
0011 // Ticket #8341: Arno Schoedl - improved handling of has_range_iterator upon
0012 // use-cases where T was const.
0013 #ifndef BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
0014 #define BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
0015 
0016 #include <boost/mpl/bool.hpp>
0017 #include <boost/mpl/eval_if.hpp>
0018 #include <boost/mpl/has_xxx.hpp>
0019 #include <boost/range/iterator.hpp>
0020 #include <boost/type_traits/remove_reference.hpp>
0021 #include <boost/utility/enable_if.hpp>
0022 
0023 namespace boost
0024 {
0025     namespace range_detail
0026     {
0027         BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
0028 
0029         template<class T, class Enabler = void>
0030         struct has_range_iterator_impl
0031             : boost::mpl::false_
0032         {
0033         };
0034 
0035         template<class T>
0036         struct has_range_iterator_impl<
0037             T,
0038             BOOST_DEDUCED_TYPENAME ::boost::enable_if<
0039                 BOOST_DEDUCED_TYPENAME mpl::eval_if<is_const<T>,
0040                     has_type<boost::range_const_iterator<
0041                                 BOOST_DEDUCED_TYPENAME remove_const<T>::type> >,
0042                     has_type<boost::range_mutable_iterator<T> >
0043                 >::type
0044             >::type
0045         >
0046             : boost::mpl::true_
0047         {
0048         };
0049 
0050         template<class T, class Enabler = void>
0051         struct has_range_const_iterator_impl
0052             : boost::mpl::false_
0053         {
0054         };
0055 
0056         template<class T>
0057         struct has_range_const_iterator_impl<
0058             T,
0059             BOOST_DEDUCED_TYPENAME ::boost::enable_if<
0060                 has_type<boost::range_const_iterator<T> >
0061             >::type
0062         >
0063             : boost::mpl::true_
0064         {
0065         };
0066 
0067     } // namespace range_detail
0068 
0069     template<class T>
0070     struct has_range_iterator
0071         : range_detail::has_range_iterator_impl<
0072             BOOST_DEDUCED_TYPENAME remove_reference<T>::type>
0073     {};
0074 
0075     template<class T>
0076     struct has_range_const_iterator
0077         : range_detail::has_range_const_iterator_impl<
0078             BOOST_DEDUCED_TYPENAME remove_reference<T>::type>
0079     {};
0080 } // namespace boost
0081 
0082 #endif // include guard
0083