#ifndef SPROUT_ITERATOR_TRAITS_HPP #define SPROUT_ITERATOR_TRAITS_HPP #include #include #include #include namespace sprout { namespace detail { // has_iterator_category SPROUT_HAS_XXX_TYPE_DEF_LAZY(iterator_category); } // namespace detail // // is_iterator // template struct is_iterator : sprout::detail::has_iterator_category > {}; namespace detail { template struct is_input_iterator_impl : std::false_type {}; template struct is_input_iterator_impl< Iterator, typename std::enable_if::value>::type > : std::is_convertible< typename std::iterator_traits::iterator_category, std::input_iterator_tag > {}; } // namespace detail // // is_input_iterator // template struct is_input_iterator : sprout::detail::is_input_iterator_impl {}; namespace detail { template struct is_output_iterator_impl : std::false_type {}; template struct is_output_iterator_impl< Iterator, typename std::enable_if::value>::type > : std::is_convertible< typename std::iterator_traits::iterator_category, std::output_iterator_tag > {}; } // namespace detail // // is_output_iterator // template struct is_output_iterator : sprout::detail::is_output_iterator_impl {}; namespace detail { template struct is_forward_iterator_impl : std::false_type {}; template struct is_forward_iterator_impl< Iterator, typename std::enable_if::value>::type > : std::is_convertible< typename std::iterator_traits::iterator_category, std::forward_iterator_tag > {}; } // namespace detail // // is_forward_iterator // template struct is_forward_iterator : sprout::detail::is_forward_iterator_impl {}; namespace detail { template struct is_bidirectional_iterator_impl : std::false_type {}; template struct is_bidirectional_iterator_impl< Iterator, typename std::enable_if::value>::type > : std::is_convertible< typename std::iterator_traits::iterator_category, std::bidirectional_iterator_tag > {}; } // namespace detail // // is_bidirectional_iterator // template struct is_bidirectional_iterator : sprout::detail::is_bidirectional_iterator_impl {}; namespace detail { template struct is_random_access_iterator_impl : std::false_type {}; template struct is_random_access_iterator_impl< Iterator, typename std::enable_if::value>::type > : std::is_convertible< typename std::iterator_traits::iterator_category, std::random_access_iterator_tag > {}; } // namespace detail // // is_random_access_iterator // template struct is_random_access_iterator : sprout::detail::is_random_access_iterator_impl {}; } // namespace sprout #endif // #ifndef SPROUT_ITERATOR_TRAITS_HPP