OpenKalman
mdspan.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2025 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
17 #ifndef OPENKALMAN_COMPATIBILITY_MDSPAN_HPP
18 #define OPENKALMAN_COMPATIBILITY_MDSPAN_HPP
19 
20 #include "language-features.hpp"
21 #include "span.hpp"
22 
23 #ifdef __cpp_lib_mdspan
24 #include <mdspan>
25 #else
26 #ifndef __cpp_lib_span
27 namespace std::experimental
28 {
29  using OpenKalman::stdex::span;
30  //using OpenKalman::stdex::dynamic_extent; // already defined in mdspan reference implementation
31  using OpenKalman::stdex::as_bytes;
32  using OpenKalman::stdex::as_writable_bytes;
33 }
34 #define OPENKALMAN_COMPATIBILITY_SPAN
35 #endif
36 
37 #include "std-lib-reference/mdspan-reference-implementation/include/experimental/mdspan"
38 
39 #undef OPENKALMAN_COMPATIBILITY_SPAN
40 
41 #endif
42 
43 namespace OpenKalman::stdex
44 {
45 #ifdef __cpp_lib_mdspan
46  using std::mdspan;
47  using std::extents;
48  using std::dextents;
49  using std::layout_left;
50  using std::layout_right
51  using std::layout_stride;
52  using std::default_accessor;
53 #else
56  using std::experimental::dextents;
61 #endif
62 
63 #ifdef __cpp_lib_mdspan
64  using std::full_extent;
65  using std::full_extent_t;
66  using std::strided_slice;
67  using std::submdspan_mapping;
68  using std::submdspan_extents;
69  using std::submdspan;
70 #else
71  using std::experimental::full_extent;
74  using std::experimental::submdspan_mapping;
75  using std::experimental::submdspan_extents;
76  using std::experimental::submdspan;
77 #endif
78 
79 }
80 
81 #endif
Definition: strided_slice.hpp:32
Definition: layout_stride.hpp:44
Definition: default_accessor.hpp:26
Definition: mdspan.hpp:34
Definitions relating to the availability of c++ language features.
Definition: full_extent_t.hpp:23
Definition: mdspan.hpp:27
Definition: layout_stride.hpp:40
Definition: layout_stride.hpp:68
Definition: basics.hpp:55
Definition: extents.hpp:372