Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / include / __algorithm / ranges_iterator_concept.h
blob9a92030403361b4089b6b458cdab35d7b825ce11
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 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
10 #define _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
12 #include <__config>
13 #include <__iterator/concepts.h>
14 #include <__iterator/iterator_traits.h>
15 #include <__type_traits/remove_cvref.h>
17 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18 # pragma GCC system_header
19 #endif
21 #if _LIBCPP_STD_VER >= 20
23 _LIBCPP_BEGIN_NAMESPACE_STD
25 namespace ranges {
27 template <class _IterMaybeQualified>
28 consteval auto __get_iterator_concept() {
29 using _Iter = __remove_cvref_t<_IterMaybeQualified>;
31 if constexpr (contiguous_iterator<_Iter>)
32 return contiguous_iterator_tag();
33 else if constexpr (random_access_iterator<_Iter>)
34 return random_access_iterator_tag();
35 else if constexpr (bidirectional_iterator<_Iter>)
36 return bidirectional_iterator_tag();
37 else if constexpr (forward_iterator<_Iter>)
38 return forward_iterator_tag();
39 else if constexpr (input_iterator<_Iter>)
40 return input_iterator_tag();
43 template <class _Iter>
44 using __iterator_concept = decltype(__get_iterator_concept<_Iter>());
46 } // namespace ranges
47 _LIBCPP_END_NAMESPACE_STD
49 #endif // _LIBCPP_STD_VER >= 20
51 #endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H