File indexing completed on 2026-05-03 08:14:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___UTILITY_IS_VALID_RANGE_H
0010 #define _LIBCPP___UTILITY_IS_VALID_RANGE_H
0011
0012 #include <__algorithm/comp.h>
0013 #include <__config>
0014 #include <__type_traits/is_constant_evaluated.h>
0015
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 # pragma GCC system_header
0018 #endif
0019
0020 _LIBCPP_BEGIN_NAMESPACE_STD
0021
0022 template <class _Tp>
0023 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
0024 __is_valid_range(const _Tp* __first, const _Tp* __last) {
0025 if (__libcpp_is_constant_evaluated()) {
0026
0027
0028
0029 return __builtin_constant_p(__first <= __last) && __first <= __last;
0030 }
0031
0032 return !__less<>()(__last, __first);
0033 }
0034
0035 _LIBCPP_END_NAMESPACE_STD
0036
0037 #endif