// -*- 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 // SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. // // Kokkos v. 4.0 // Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // //===---------------------------------------------------------------------===// #ifndef _LIBCUDACXX___MDSPAN_CONCEPTS_H #define _LIBCUDACXX___MDSPAN_CONCEPTS_H #include #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) # pragma clang system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) # pragma system_header #endif // no system header #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include _LIBCUDACXX_BEGIN_NAMESPACE_STD namespace __mdspan_detail { // [mdspan.layout.stride.expo]/3 template struct __is_extents : false_type {}; template _CCCL_INLINE_VAR constexpr bool __is_extents_v = __is_extents<_Tp>::value; // [mdspan.layout.general]/2 template _CCCL_INLINE_VAR constexpr bool __is_mapping_of = _CCCL_TRAIT(is_same, typename _Layout::template mapping, _Mapping); // [mdspan.layout.reqmts]/1 template _CCCL_CONCEPT __layout_mapping_req_type = _CCCL_REQUIRES_EXPR((_Mapping))( requires(copyable<_Mapping>), requires(equality_comparable<_Mapping>), requires(_CCCL_TRAIT(is_nothrow_move_constructible, _Mapping)), requires(_CCCL_TRAIT(is_move_assignable, _Mapping)), requires(_CCCL_TRAIT(is_nothrow_swappable, _Mapping))); // [mdspan.layout.reqmts]/2-4 template _CCCL_CONCEPT __layout_mapping_req_types = _CCCL_REQUIRES_EXPR((_Mapping))( requires(__is_extents_v), requires(same_as), requires(same_as), requires(__is_mapping_of)); template _CCCL_CONCEPT __layout_mapping_req_members = _CCCL_REQUIRES_EXPR((_Mapping), const _Mapping& __map)( _Same_as(const typename _Mapping::extents_type&) __map.extents(), _Same_as(typename _Mapping::index_type) __map.required_span_size(), _Same_as(bool) __map.is_unique(), _Same_as(bool) __map.is_exhaustive(), _Same_as(bool) __map.is_strided()); template _CCCL_CONCEPT __layout_mapping_req = _CCCL_REQUIRES_EXPR((_Mapping))( requires(__layout_mapping_req_type<_Mapping>), requires(__layout_mapping_req_types<_Mapping>), requires(__layout_mapping_req_members<_Mapping>)); // [mdspan.layout.stride.expo]/4 // NOTE: integral_constant::value only checks that this is a constant expression template _CCCL_CONCEPT __layout_mapping_alike = _CCCL_REQUIRES_EXPR((_Mapping))( requires(__is_mapping_of), requires(__is_extents_v), requires(same_as), requires(same_as), requires(same_as), (integral_constant::value), (integral_constant::value), (integral_constant::value)); template _CCCL_CONCEPT __all_convertible_to_index_type = (_CCCL_TRAIT(is_convertible, _Indices, _IndexType) && ... && true) && (_CCCL_TRAIT(is_nothrow_constructible, _IndexType, _Indices) && ... && true); } // namespace __mdspan_detail template _CCCL_CONCEPT __index_pair_like = _CCCL_REQUIRES_EXPR((_Tp, _IndexType))( requires(__pair_like<_Tp>), requires(convertible_to, _IndexType>), requires(convertible_to, _IndexType>)); // [mdspan.submdspan.strided.slice]/3 template _CCCL_CONCEPT __index_like = _CCCL_TRAIT(is_signed, _Tp) || _CCCL_TRAIT(is_unsigned, _Tp) || __integral_constant_like<_Tp>; _LIBCUDACXX_END_NAMESPACE_STD #endif // _LIBCUDACXX___MDSPAN_CONCEPTS_H