Debian Codegraph @

packages/kokkos/tpls/mdspan/include/experimental/__p2630_bits/strided_slice.hpp

raw
1
2 //@HEADER
3 // ************************************************************************
4 //
5 // Kokkos v. 4.0
6 // Copyright (2022) National Technology & Engineering
7 // Solutions of Sandia, LLC (NTESS).
8 //
9 // Under the terms of Contract DE-NA0003525 with NTESS,
10 // the U.S. Government retains certain rights in this software.
11 //
12 // Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions.
13 // See https://kokkos.org/LICENSE for license information.
14 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
15 //
16 //@HEADER
17
18 #pragma once
19
20 #include <type_traits>
21
22 namespace MDSPAN_IMPL_STANDARD_NAMESPACE {
23
24 namespace {
25 template<class T>
26 struct __mdspan_is_integral_constant: std::false_type {};
27
28 template<class T, T val>
29 struct __mdspan_is_integral_constant<std::integral_constant<T,val>>: std::true_type {};
30 }
31
32 // Slice Specifier allowing for strides and compile time extent
33 template <class OffsetType, class ExtentType, class StrideType>
34 struct strided_slice {
35 using offset_type = OffsetType;
36 using extent_type = ExtentType;
37 using stride_type = StrideType;
38
39 _MDSPAN_NO_UNIQUE_ADDRESS OffsetType offset{};
40 _MDSPAN_NO_UNIQUE_ADDRESS ExtentType extent{};
41 _MDSPAN_NO_UNIQUE_ADDRESS StrideType stride{};
42
43 static_assert(std::is_integral_v<OffsetType> || __mdspan_is_integral_constant<OffsetType>::value);
44 static_assert(std::is_integral_v<ExtentType> || __mdspan_is_integral_constant<ExtentType>::value);
45 static_assert(std::is_integral_v<StrideType> || __mdspan_is_integral_constant<StrideType>::value);
46 };
47
48 } // MDSPAN_IMPL_STANDARD_NAMESPACE