CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
103 lines
3.1 KiB
C++
103 lines
3.1 KiB
C++
// -*- 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___RANGES_DATA_H
|
|
#define _LIBCPP___RANGES_DATA_H
|
|
|
|
#include <__concepts/class_or_enum.h>
|
|
#include <__config>
|
|
#include <__iterator/concepts.h>
|
|
#include <__iterator/iterator_traits.h>
|
|
#include <__memory/pointer_traits.h>
|
|
#include <__ranges/access.h>
|
|
#include <__type_traits/decay.h>
|
|
#include <__type_traits/is_object.h>
|
|
#include <__type_traits/is_pointer.h>
|
|
#include <__type_traits/is_reference.h>
|
|
#include <__type_traits/remove_pointer.h>
|
|
#include <__type_traits/remove_reference.h>
|
|
#include <__utility/auto_cast.h>
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
# pragma GCC system_header
|
|
#endif
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
#if _LIBCPP_STD_VER >= 20
|
|
|
|
// [range.prim.data]
|
|
|
|
namespace ranges {
|
|
namespace __data {
|
|
template <class _Tp>
|
|
concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
|
|
|
|
template <class _Tp>
|
|
concept __member_data = __can_borrow<_Tp> && requires(_Tp&& __t) {
|
|
{ _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
|
|
};
|
|
|
|
template <class _Tp>
|
|
concept __ranges_begin_invocable = !__member_data<_Tp> && __can_borrow<_Tp> && requires(_Tp&& __t) {
|
|
{ ranges::begin(__t) } -> contiguous_iterator;
|
|
};
|
|
|
|
struct __fn {
|
|
template <__member_data _Tp>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(noexcept(__t.data())) {
|
|
return __t.data();
|
|
}
|
|
|
|
template <__ranges_begin_invocable _Tp>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
|
|
noexcept(noexcept(std::to_address(ranges::begin(__t)))) {
|
|
return std::to_address(ranges::begin(__t));
|
|
}
|
|
};
|
|
} // namespace __data
|
|
|
|
inline namespace __cpo {
|
|
inline constexpr auto data = __data::__fn{};
|
|
} // namespace __cpo
|
|
} // namespace ranges
|
|
|
|
// [range.prim.cdata]
|
|
|
|
namespace ranges {
|
|
namespace __cdata {
|
|
struct __fn {
|
|
template <class _Tp>
|
|
requires is_lvalue_reference_v<_Tp&&>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const
|
|
noexcept(noexcept(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))))
|
|
-> decltype(ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t))) {
|
|
return ranges::data(static_cast<const remove_reference_t<_Tp>&>(__t));
|
|
}
|
|
|
|
template <class _Tp>
|
|
requires is_rvalue_reference_v<_Tp&&>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const noexcept(
|
|
noexcept(ranges::data(static_cast<const _Tp&&>(__t)))) -> decltype(ranges::data(static_cast<const _Tp&&>(__t))) {
|
|
return ranges::data(static_cast<const _Tp&&>(__t));
|
|
}
|
|
};
|
|
} // namespace __cdata
|
|
|
|
inline namespace __cpo {
|
|
inline constexpr auto cdata = __cdata::__fn{};
|
|
} // namespace __cpo
|
|
} // namespace ranges
|
|
|
|
#endif // _LIBCPP_STD_VER >= 20
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
#endif // _LIBCPP___RANGES_DATA_H
|