OpenKalman
span.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_SPAN_HPP
18 #define OPENKALMAN_COMPATIBILITY_SPAN_HPP
19 
20 #ifdef __cpp_lib_span
21 #include <span>
22 #else
23 #include "std-lib-reference/span-tcbrindle/include/tcb/span.hpp"
24 #endif
25 
26 #include "basics/compatibility/ranges/range-access.hpp"
27 
28 namespace OpenKalman::stdex
29 {
30 #ifdef __cpp_lib_span
31  using std::span;
32  using std::dynamic_extent;
33  using std::as_bytes;
34  using std::as_writable_bytes;
35 #else
36  using tcb::span;
37  using tcb::dynamic_extent;
38  using tcb::as_bytes;
39  using tcb::as_writable_bytes;
40 #endif
41 
42 }
43 
44 
45 #ifndef __cpp_lib_span
46 #ifdef __cpp_lib_ranges
47 namespace std::ranges
48 #else
49 namespace OpenKalman::stdex::ranges
50 #endif
51 {
52  template<typename T, std::size_t Extent>
53  constexpr bool enable_borrowed_range<OpenKalman::stdex::span<T, Extent>> = true;
54 
55  template<typename T, std::size_t Extent>
56  constexpr bool enable_view<OpenKalman::stdex::span<T, Extent>> = true;
57 
58 }
59 #endif
60 
61 
62 
63 
64 #endif
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition: basics.hpp:55