diff options
author | Christian Trott <crtrott@sandia.gov> | 2023-06-29 10:06:47 -0400 |
---|---|---|
committer | Louis Dionne <ldionne.2@gmail.com> | 2023-06-29 10:12:17 -0400 |
commit | cfa096d9c92e758c4916dfd06d107fcec2edeca4 (patch) | |
tree | f02b849929843215d4d334804e53f7403ced3776 /libcxx/include/__fwd | |
parent | 8038086aa75a122e5e632ebb1e7da06a2f7eed4b (diff) | |
download | llvm-cfa096d9c92e758c4916dfd06d107fcec2edeca4.zip llvm-cfa096d9c92e758c4916dfd06d107fcec2edeca4.tar.gz llvm-cfa096d9c92e758c4916dfd06d107fcec2edeca4.tar.bz2 |
[libc++][mdspan] Implement layout_right
This commit implements layout_right in support of C++23 mdspan
(https://wg21.link/p0009). layout_right is a layout mapping policy
whose index mapping corresponds to the memory layout of multidimensional
C-arrays, and is thus also referred to as the C-layout.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/D151267
Diffstat (limited to 'libcxx/include/__fwd')
-rw-r--r-- | libcxx/include/__fwd/mdspan.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/libcxx/include/__fwd/mdspan.h b/libcxx/include/__fwd/mdspan.h new file mode 100644 index 0000000..591e5f6 --- /dev/null +++ b/libcxx/include/__fwd/mdspan.h @@ -0,0 +1,63 @@ +// -*- 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 +// +// 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 _LIBCPP___MDSPAN_LAYOUTS_H +#define _LIBCPP___MDSPAN_LAYOUTS_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 23 + +/* +// Will be implemented with follow on revision +// Layout policy with a mapping which corresponds to FORTRAN-style array layouts +struct layout_left { + template<class Extents> + class mapping; +}; +*/ + +// Layout policy with a mapping which corresponds to C-style array layouts +struct layout_right { + template <class Extents> + class mapping; +}; + +/* +// Will be implemented with follow on revision +// Layout policy with a unique mapping where strides are arbitrary +struct layout_stride { + template<class Extents> + class mapping; +}; +*/ + +#endif // _LIBCPP_STD_VER >= 23 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___MDSPAN_LAYOUTS_H |