2021-12-02 17:57:55 -08:00
|
|
|
// -*- C++ -*-
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP___MEMORY_CONCEPTS_H
|
|
|
|
#define _LIBCPP___MEMORY_CONCEPTS_H
|
|
|
|
|
2022-11-02 20:27:42 +01:00
|
|
|
#include <__concepts/same_as.h>
|
2021-12-02 17:57:55 -08:00
|
|
|
#include <__config>
|
|
|
|
#include <__iterator/concepts.h>
|
|
|
|
#include <__iterator/iterator_traits.h>
|
|
|
|
#include <__iterator/readable_traits.h>
|
|
|
|
#include <__ranges/access.h>
|
|
|
|
#include <__ranges/concepts.h>
|
2022-12-21 00:07:17 +01:00
|
|
|
#include <__type_traits/is_reference.h>
|
|
|
|
#include <__type_traits/remove_cvref.h>
|
2021-12-02 17:57:55 -08:00
|
|
|
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2022-02-01 20:16:40 -05:00
|
|
|
# pragma GCC system_header
|
2021-12-02 17:57:55 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
2023-02-14 00:56:09 +01:00
|
|
|
#if _LIBCPP_STD_VER >= 20
|
[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.
The logic here is that we are disabling *only* things in `std::ranges::`.
Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`,
`common_iterator`, `projected`, `swappable`, and so on. Then, we include
anything from `std::ranges::` that is required in order to make those things
work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,
`ranges::iter_move`, and so on. But then that's all. Everything else (including
notably all of the "views" and the `std::views` namespace itself) is still
locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.
Differential Revision: https://reviews.llvm.org/D118736
2022-02-01 16:52:02 -05:00
|
|
|
|
2021-12-02 17:57:55 -08:00
|
|
|
namespace ranges {
|
|
|
|
|
|
|
|
// [special.mem.concepts]
|
|
|
|
|
|
|
|
// This concept ensures that uninitialized algorithms can construct an object
|
|
|
|
// at the address pointed-to by the iterator, which requires an lvalue.
|
|
|
|
template <class _Ip>
|
|
|
|
concept __nothrow_input_iterator =
|
|
|
|
input_iterator<_Ip> &&
|
|
|
|
is_lvalue_reference_v<iter_reference_t<_Ip>> &&
|
|
|
|
same_as<remove_cvref_t<iter_reference_t<_Ip>>, iter_value_t<_Ip>>;
|
|
|
|
|
|
|
|
template <class _Sp, class _Ip>
|
|
|
|
concept __nothrow_sentinel_for = sentinel_for<_Sp, _Ip>;
|
|
|
|
|
|
|
|
template <class _Rp>
|
|
|
|
concept __nothrow_input_range =
|
|
|
|
range<_Rp> &&
|
|
|
|
__nothrow_input_iterator<iterator_t<_Rp>> &&
|
|
|
|
__nothrow_sentinel_for<sentinel_t<_Rp>, iterator_t<_Rp>>;
|
|
|
|
|
|
|
|
template <class _Ip>
|
|
|
|
concept __nothrow_forward_iterator =
|
|
|
|
__nothrow_input_iterator<_Ip> &&
|
|
|
|
forward_iterator<_Ip> &&
|
|
|
|
__nothrow_sentinel_for<_Ip, _Ip>;
|
|
|
|
|
|
|
|
template <class _Rp>
|
|
|
|
concept __nothrow_forward_range =
|
|
|
|
__nothrow_input_range<_Rp> &&
|
|
|
|
__nothrow_forward_iterator<iterator_t<_Rp>>;
|
|
|
|
|
|
|
|
} // namespace ranges
|
[libc++] Guard much of std::ranges under _LIBCPP_HAS_NO_INCOMPLETE_RANGES.
The logic here is that we are disabling *only* things in `std::ranges::`.
Everything in `std::` is permitted, including `default_sentinel`, `contiguous_iterator`,
`common_iterator`, `projected`, `swappable`, and so on. Then, we include
anything from `std::ranges::` that is required in order to make those things
work: `ranges::swap`, `ranges::swap_ranges`, `input_range`, `ranges::begin`,
`ranges::iter_move`, and so on. But then that's all. Everything else (including
notably all of the "views" and the `std::views` namespace itself) is still
locked up behind `_LIBCPP_HAS_NO_INCOMPLETE_RANGES`.
Differential Revision: https://reviews.llvm.org/D118736
2022-02-01 16:52:02 -05:00
|
|
|
|
2023-02-14 00:56:09 +01:00
|
|
|
#endif // _LIBCPP_STD_VER >= 20
|
2021-12-02 17:57:55 -08:00
|
|
|
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
|
|
|
#endif // _LIBCPP___MEMORY_CONCEPTS_H
|