2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___MEMORY_CONCEPTS_H
11 #define _LIBCPP___MEMORY_CONCEPTS_H
14 #include <__iterator/concepts.h>
15 #include <__iterator/iterator_traits.h>
16 #include <__iterator/readable_traits.h>
17 #include <__ranges/access.h>
18 #include <__ranges/concepts.h>
20 #include <type_traits>
22 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
23 #pragma GCC system_header
26 _LIBCPP_BEGIN_NAMESPACE_STD
28 #if !defined(_LIBCPP_HAS_NO_RANGES)
31 // [special.mem.concepts]
33 // This concept ensures that uninitialized algorithms can construct an object
34 // at the address pointed-to by the iterator, which requires an lvalue.
36 concept __nothrow_input_iterator
=
37 input_iterator
<_Ip
> &&
38 is_lvalue_reference_v
<iter_reference_t
<_Ip
>> &&
39 same_as
<remove_cvref_t
<iter_reference_t
<_Ip
>>, iter_value_t
<_Ip
>>;
41 template <class _Sp
, class _Ip
>
42 concept __nothrow_sentinel_for
= sentinel_for
<_Sp
, _Ip
>;
45 concept __nothrow_input_range
=
47 __nothrow_input_iterator
<iterator_t
<_Rp
>> &&
48 __nothrow_sentinel_for
<sentinel_t
<_Rp
>, iterator_t
<_Rp
>>;
51 concept __nothrow_forward_iterator
=
52 __nothrow_input_iterator
<_Ip
> &&
53 forward_iterator
<_Ip
> &&
54 __nothrow_sentinel_for
<_Ip
, _Ip
>;
57 concept __nothrow_forward_range
=
58 __nothrow_input_range
<_Rp
> &&
59 __nothrow_forward_iterator
<iterator_t
<_Rp
>>;
62 #endif // !defined(_LIBCPP_HAS_NO_RANGES)
64 _LIBCPP_END_NAMESPACE_STD
66 #endif // _LIBCPP___MEMORY_CONCEPTS_H