diff options
Diffstat (limited to 'libcxx/include/__iterator/iterator_traits.h')
| -rw-r--r-- | libcxx/include/__iterator/iterator_traits.h | 49 | 
1 files changed, 38 insertions, 11 deletions
diff --git a/libcxx/include/__iterator/iterator_traits.h b/libcxx/include/__iterator/iterator_traits.h index 254f8c2339e4..c9d8944bfee3 100644 --- a/libcxx/include/__iterator/iterator_traits.h +++ b/libcxx/include/__iterator/iterator_traits.h @@ -10,11 +10,32 @@  #ifndef _LIBCPP___ITERATOR_ITERATOR_TRAITS_H  #define _LIBCPP___ITERATOR_ITERATOR_TRAITS_H +#include <__concepts/arithmetic.h> +#include <__concepts/constructible.h> +#include <__concepts/convertible_to.h> +#include <__concepts/copyable.h> +#include <__concepts/equality_comparable.h> +#include <__concepts/same_as.h> +#include <__concepts/totally_ordered.h>  #include <__config> +#include <__fwd/pair.h>  #include <__iterator/incrementable_traits.h>  #include <__iterator/readable_traits.h> -#include <concepts> -#include <type_traits> +#include <__type_traits/add_const.h> +#include <__type_traits/common_reference.h> +#include <__type_traits/conditional.h> +#include <__type_traits/disjunction.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_object.h> +#include <__type_traits/is_primary_template.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/is_valid_expansion.h> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/remove_cvref.h> +#include <__type_traits/void_t.h> +#include <__utility/declval.h> +#include <cstddef>  #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)  #  pragma GCC system_header @@ -39,7 +60,7 @@ concept __dereferenceable = requires(_Tp& __t) {  // [iterator.traits]  template<__dereferenceable _Tp> -using iter_reference_t = decltype(*declval<_Tp&>()); +using iter_reference_t = decltype(*std::declval<_Tp&>());  #endif // _LIBCPP_STD_VER > 17 @@ -106,11 +127,11 @@ struct __has_iterator_typedefs  {  private:      template <class _Up> static false_type __test(...); -    template <class _Up> static true_type __test(typename __void_t<typename _Up::iterator_category>::type* = 0, -                                                 typename __void_t<typename _Up::difference_type>::type* = 0, -                                                 typename __void_t<typename _Up::value_type>::type* = 0, -                                                 typename __void_t<typename _Up::reference>::type* = 0, -                                                 typename __void_t<typename _Up::pointer>::type* = 0); +    template <class _Up> static true_type __test(__void_t<typename _Up::iterator_category>* = nullptr, +                                                 __void_t<typename _Up::difference_type>* = nullptr, +                                                 __void_t<typename _Up::value_type>* = nullptr, +                                                 __void_t<typename _Up::reference>* = nullptr, +                                                 __void_t<typename _Up::pointer>* = nullptr);  public:      static const bool value = decltype(__test<_Tp>(0,0,0,0,0))::value;  }; @@ -252,7 +273,7 @@ struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { using type = typ  template<class _Ip>    requires requires(_Ip& __i) { __i.operator->(); } && (!__has_member_pointer<_Ip>)  struct __iterator_traits_member_pointer_or_arrow_or_void<_Ip> { -  using type = decltype(declval<_Ip&>().operator->()); +  using type = decltype(std::declval<_Ip&>().operator->());  };  // Otherwise, `reference` names `iter-reference-t<I>`. @@ -406,7 +427,7 @@ requires is_object_v<_Tp>  struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*>  {      typedef ptrdiff_t difference_type; -    typedef typename remove_cv<_Tp>::type value_type; +    typedef __remove_cv_t<_Tp> value_type;      typedef _Tp* pointer;      typedef _Tp& reference;      typedef random_access_iterator_tag iterator_category; @@ -491,7 +512,7 @@ template<class _InputIterator>  using __iter_value_type = typename iterator_traits<_InputIterator>::value_type;  template<class _InputIterator> -using __iter_key_type = typename remove_const<typename iterator_traits<_InputIterator>::value_type::first_type>::type; +using __iter_key_type = __remove_const_t<typename iterator_traits<_InputIterator>::value_type::first_type>;  template<class _InputIterator>  using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type; @@ -507,6 +528,12 @@ using __iterator_category_type = typename iterator_traits<_Iter>::iterator_categ  template <class _Iter>  using __iterator_pointer_type = typename iterator_traits<_Iter>::pointer; +template <class _Iter> +using __iter_diff_t = typename iterator_traits<_Iter>::difference_type; + +template<class _InputIterator> +using __iter_value_type = typename iterator_traits<_InputIterator>::value_type; +  _LIBCPP_END_NAMESPACE_STD  #endif // _LIBCPP___ITERATOR_ITERATOR_TRAITS_H  | 
