has_range_iterator.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2010. 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. #ifndef BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
  11. #define BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
  12. #include <boost/mpl/bool.hpp>
  13. #include <boost/mpl/has_xxx.hpp>
  14. #include <boost/range/iterator.hpp>
  15. #include <boost/utility/enable_if.hpp>
  16. namespace boost
  17. {
  18. namespace range_detail
  19. {
  20. BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
  21. template<class T, class Enabler = void>
  22. struct has_range_iterator_impl
  23. : boost::mpl::false_
  24. {
  25. };
  26. template<class T>
  27. struct has_range_iterator_impl<T, BOOST_DEDUCED_TYPENAME enable_if< has_type< range_mutable_iterator<T> > >::type>
  28. : boost::mpl::true_
  29. {
  30. };
  31. template<class T, class Enabler = void>
  32. struct has_range_const_iterator_impl
  33. : boost::mpl::false_
  34. {
  35. };
  36. template<class T>
  37. struct has_range_const_iterator_impl<T, BOOST_DEDUCED_TYPENAME enable_if< has_type< range_const_iterator<T> > >::type>
  38. : boost::mpl::true_
  39. {
  40. };
  41. } // namespace range_detail
  42. template<class T>
  43. struct has_range_iterator
  44. : range_detail::has_range_iterator_impl<T>
  45. {};
  46. template<class T>
  47. struct has_range_const_iterator
  48. : range_detail::has_range_const_iterator_impl<T>
  49. {};
  50. } // namespace boost
  51. #endif // include guard