OpenKalman
layout_of.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) 2019-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 
16 #ifndef OPENKALMAN_LAYOUT_OF_HPP
17 #define OPENKALMAN_LAYOUT_OF_HPP
18 
21 
22 namespace OpenKalman
23 {
27 #ifdef __cpp_concepts
28  template<typename T>
29 #else
30  template<typename T, typename = void>
31 #endif
32  struct layout_of {};
33 
34 
38 #ifdef __cpp_concepts
39  template<indexible T>
40  struct layout_of<T>
41 #else
42  template<typename T>
43  struct layout_of<T, std::enable_if_t<indexible<T>>>
44 #endif
45  {
46  using type = typename std::decay_t<decltype(get_mdspan(std::declval<T&>()))>::layout_type;
47  static_assert(internal::layout_mapping_policy<type>);
48  };
49 
50 
54  template<typename T>
55  using layout_of_t = typename layout_of<T>::type;
56 
57 }
58 
59 #endif
Definition for layout_mapping_policy.
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition of get_mdspan function.
The layout_mapping_policy of an indexible object.
Definition: layout_of.hpp:32
typename layout_of< T >::type layout_of_t
helper template for layout_of.
Definition: layout_of.hpp:55