Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:34

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //                        Kokkos v. 4.0
0009 //       Copyright (2022) National Technology & Engineering
0010 //               Solutions of Sandia, LLC (NTESS).
0011 //
0012 // Under the terms of Contract DE-NA0003525 with NTESS,
0013 // the U.S. Government retains certain rights in this software.
0014 //
0015 //===---------------------------------------------------------------------===//
0016 
0017 #ifndef _LIBCPP___CXX03___MDSPAN_DEFAULT_ACCESSOR_H
0018 #define _LIBCPP___CXX03___MDSPAN_DEFAULT_ACCESSOR_H
0019 
0020 #include <__cxx03/__config>
0021 #include <__cxx03/__type_traits/is_abstract.h>
0022 #include <__cxx03/__type_traits/is_array.h>
0023 #include <__cxx03/__type_traits/is_convertible.h>
0024 #include <__cxx03/__type_traits/remove_const.h>
0025 #include <__cxx03/cinttypes>
0026 #include <__cxx03/cstddef>
0027 
0028 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0029 #  pragma GCC system_header
0030 #endif
0031 
0032 _LIBCPP_PUSH_MACROS
0033 #include <__cxx03/__undef_macros>
0034 
0035 _LIBCPP_BEGIN_NAMESPACE_STD
0036 
0037 #if _LIBCPP_STD_VER >= 23
0038 
0039 template <class _ElementType>
0040 struct default_accessor {
0041   static_assert(!is_array_v<_ElementType>, "default_accessor: template argument may not be an array type");
0042   static_assert(!is_abstract_v<_ElementType>, "default_accessor: template argument may not be an abstract class");
0043 
0044   using offset_policy    = default_accessor;
0045   using element_type     = _ElementType;
0046   using reference        = _ElementType&;
0047   using data_handle_type = _ElementType*;
0048 
0049   _LIBCPP_HIDE_FROM_ABI constexpr default_accessor() noexcept = default;
0050   template <class _OtherElementType>
0051     requires(is_convertible_v<_OtherElementType (*)[], element_type (*)[]>)
0052   _LIBCPP_HIDE_FROM_ABI constexpr default_accessor(default_accessor<_OtherElementType>) noexcept {}
0053 
0054   _LIBCPP_HIDE_FROM_ABI constexpr reference access(data_handle_type __p, size_t __i) const noexcept { return __p[__i]; }
0055   _LIBCPP_HIDE_FROM_ABI constexpr data_handle_type offset(data_handle_type __p, size_t __i) const noexcept {
0056     return __p + __i;
0057   }
0058 };
0059 
0060 #endif // _LIBCPP_STD_VER >= 23
0061 
0062 _LIBCPP_END_NAMESPACE_STD
0063 
0064 _LIBCPP_POP_MACROS
0065 
0066 #endif // _LIBCPP___CXX03___MDSPAN_DEFAULT_ACCESSOR_H