/// \file // Range v3 library // // Copyright Eric Niebler 2013-present // // Use, modification and distribution is 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) // // Project home: https://github.com/ericniebler/range-v3 // #ifndef RANGES_V3_ITERATOR_TRAITS_HPP #define RANGES_V3_ITERATOR_TRAITS_HPP #include #include #include #include #include #include // for iter_move, iter_swap #include namespace ranges { /// \addtogroup group-iterator /// @{ /// \cond using input_iterator_tag RANGES_DEPRECATED( "Please switch to the standard iterator tags") = std::input_iterator_tag; using forward_iterator_tag RANGES_DEPRECATED( "Please switch to the standard iterator tags") = std::forward_iterator_tag; using bidirectional_iterator_tag RANGES_DEPRECATED( "Please switch to the standard iterator tags") = std::bidirectional_iterator_tag; using random_access_iterator_tag RANGES_DEPRECATED( "Please switch to the standard iterator tags") = std::random_access_iterator_tag; /// \cond struct contiguous_iterator_tag : std::random_access_iterator_tag {}; /// \cond struct input_iterator_concept; struct forward_iterator_concept; struct bidirectional_iterator_concept; struct random_access_iterator_concept; struct contiguous_iterator_concept; namespace detail { using input_iterator_tag_ = ::concepts::tag; using forward_iterator_tag_ = ::concepts::tag; using bidirectional_iterator_tag_ = ::concepts::tag; using random_access_iterator_tag_ = ::concepts::tag; using contiguous_iterator_tag_ = ::concepts::tag; template, typename R = decltype(iter_move(std::declval())), typename = R &> using iter_rvalue_reference_t = R; template RANGES_INLINE_VAR constexpr bool has_nothrow_iter_move_v = noexcept(iter_rvalue_reference_t(ranges::iter_move(std::declval()))); } // namespace detail /// \endcond template using iter_rvalue_reference_t = detail::iter_rvalue_reference_t; template using iter_common_reference_t = common_reference_t, iter_value_t &>; #if defined(RANGES_DEEP_STL_INTEGRATION) && RANGES_DEEP_STL_INTEGRATION && \ !defined(RANGES_DOXYGEN_INVOKED) template using iter_difference_t = typename detail::if_then_t, std::iterator_traits, incrementable_traits>::difference_type; #else template using iter_difference_t = typename incrementable_traits::difference_type; #endif // Defined in // template // using iter_value_t = ... // Defined in // template // using iter_reference_t = detail::iter_reference_t_; // Defined in : // template // inline constexpr bool disable_sized_sentinel = false; /// \cond namespace detail { template using iter_size_t = meta::_t>::value, std::make_unsigned>, meta::id>>>; template using iter_arrow_t = decltype(std::declval().operator->()); template using iter_pointer_t = meta::_t>::value, meta::defer, std::add_pointer>>>; template struct difference_type_ : meta::defer {}; template struct value_type_ : meta::defer {}; template struct size_type_ : meta::defer {}; } // namespace detail template using difference_type_t RANGES_DEPRECATED( "ranges::difference_type_t is deprecated. Please use " "ranges::iter_difference_t instead.") = iter_difference_t; template using value_type_t RANGES_DEPRECATED( "ranges::value_type_t is deprecated. Please use " "ranges::iter_value_t instead.") = iter_value_t; template using reference_t RANGES_DEPRECATED( "ranges::reference_t is deprecated. Use ranges::iter_reference_t " "instead.") = iter_reference_t; template using rvalue_reference_t RANGES_DEPRECATED( "rvalue_reference_t is deprecated; " "use iter_rvalue_reference_t instead") = iter_rvalue_reference_t; template struct RANGES_DEPRECATED( "ranges::size_type is deprecated. Iterators do not have an associated " "size_type.") size_type : detail::size_type_ {}; template using size_type_t RANGES_DEPRECATED("size_type_t is deprecated.") = detail::iter_size_t; /// \endcond namespace cpp20 { using ranges::iter_common_reference_t; using ranges::iter_difference_t; using ranges::iter_reference_t; using ranges::iter_rvalue_reference_t; using ranges::iter_value_t; // Specialize these in the ranges:: namespace using ranges::disable_sized_sentinel; template using incrementable_traits = ranges::incrementable_traits; template using readable_traits = ranges::readable_traits; } // namespace cpp20 /// @} } // namespace ranges #endif // RANGES_V3_ITERATOR_TRAITS_HPP