Warning: This file is not a C or C++ file. It does not have highlighting.

1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
10#define _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
11
12#include <__config>
13#include <__iterator/concepts.h>
14#include <__iterator/iterator_traits.h>
15#include <__type_traits/remove_cvref.h>
16
17#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18# pragma GCC system_header
19#endif
20
21_LIBCPP_PUSH_MACROS
22#include <__undef_macros>
23
24#if _LIBCPP_STD_VER >= 20
25
26_LIBCPP_BEGIN_NAMESPACE_STD
27
28namespace ranges {
29
30template <class _IterMaybeQualified>
31consteval auto __get_iterator_concept() {
32 using _Iter = __remove_cvref_t<_IterMaybeQualified>;
33
34 if constexpr (contiguous_iterator<_Iter>)
35 return contiguous_iterator_tag();
36 else if constexpr (random_access_iterator<_Iter>)
37 return random_access_iterator_tag();
38 else if constexpr (bidirectional_iterator<_Iter>)
39 return bidirectional_iterator_tag();
40 else if constexpr (forward_iterator<_Iter>)
41 return forward_iterator_tag();
42 else if constexpr (input_iterator<_Iter>)
43 return input_iterator_tag();
44}
45
46template <class _Iter>
47using __iterator_concept _LIBCPP_NODEBUG = decltype(ranges::__get_iterator_concept<_Iter>());
48
49} // namespace ranges
50_LIBCPP_END_NAMESPACE_STD
51
52#endif // _LIBCPP_STD_VER >= 20
53
54_LIBCPP_POP_MACROS
55
56#endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
57

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of libcxx/include/__algorithm/ranges_iterator_concept.h