64 lines · c
1// -*- C++ -*-2//===----------------------------------------------------------------------===//3//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-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCPP___MEMORY_CONCEPTS_H11#define _LIBCPP___MEMORY_CONCEPTS_H12 13#include <__concepts/same_as.h>14#include <__config>15#include <__iterator/concepts.h>16#include <__iterator/iterator_traits.h>17#include <__iterator/readable_traits.h>18#include <__ranges/access.h>19#include <__ranges/concepts.h>20#include <__type_traits/is_reference.h>21#include <__type_traits/remove_cvref.h>22#include <__type_traits/remove_reference.h> // TODO(modules): This should not be required23 24#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)25# pragma GCC system_header26#endif27 28_LIBCPP_BEGIN_NAMESPACE_STD29 30#if _LIBCPP_STD_VER >= 2031 32namespace ranges {33 34// [special.mem.concepts]35 36// This concept ensures that uninitialized algorithms can construct an object37// at the address pointed-to by the iterator, which requires an lvalue.38template <class _Ip>39concept __nothrow_input_iterator =40 input_iterator<_Ip> && is_lvalue_reference_v<iter_reference_t<_Ip>> &&41 same_as<remove_cvref_t<iter_reference_t<_Ip>>, iter_value_t<_Ip>>;42 43template <class _Sp, class _Ip>44concept __nothrow_sentinel_for = sentinel_for<_Sp, _Ip>;45 46template <class _Rp>47concept __nothrow_input_range =48 range<_Rp> && __nothrow_input_iterator<iterator_t<_Rp>> && __nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;49 50template <class _Ip>51concept __nothrow_forward_iterator =52 __nothrow_input_iterator<_Ip> && forward_iterator<_Ip> && __nothrow_sentinel_for<_Ip, _Ip>;53 54template <class _Rp>55concept __nothrow_forward_range = __nothrow_input_range<_Rp> && __nothrow_forward_iterator<iterator_t<_Rp>>;56 57} // namespace ranges58 59#endif // _LIBCPP_STD_VER >= 2060 61_LIBCPP_END_NAMESPACE_STD62 63#endif // _LIBCPP___MEMORY_CONCEPTS_H64