OpenKalman
pattern_collection_for.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) 2024-2026 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_COMPATIBLE_SHAPE_WITH_HPP
17 #define OPENKALMAN_COMPATIBLE_SHAPE_WITH_HPP
18 
19 #include "patterns/patterns.hpp"
21 
22 namespace OpenKalman
23 {
24  namespace detail
25  {
26 #ifndef __cpp_concepts
27  template<typename P, typename T, applicability a, typename = void>
28  struct pattern_collection_for_impl : std::false_type{};
29 
30  template<typename P, typename T, applicability a>
31  struct pattern_collection_for_impl<P, T, a, std::enable_if_t<
32  patterns::collection_compares_with<
33  decltype(patterns::to_extents(std::declval<P>())),
34  decltype(get_pattern_collection(get_mdspan(std::declval<std::add_lvalue_reference_t<T>>()))),
35  &stdex::is_eq, a>>>
36  : std::true_type {};
37 #endif
38  }
39 
40 
47  template<typename P, typename T, applicability a = applicability::permitted>
48 #ifdef __cpp_concepts
49  concept pattern_collection_for =
51  decltype(patterns::to_extents(std::declval<P>())),
52  decltype(get_pattern_collection(get_mdspan(std::declval<std::add_lvalue_reference_t<T>>()))),
53  &stdex::is_eq, a>;
54 #else
55  constexpr bool pattern_collection_for = detail::pattern_collection_for_impl<P, T, a>::value;
56 #endif
57 
58 
59 }
60 
61 #endif
decltype(auto) constexpr get_pattern_collection(T &&t)
Get the patterns::pattern_collection associated with indexible object T.
Definition: get_pattern_collection.hpp:36
constexpr bool collection_compares_with
Compares two pattern_collection objects.
Definition: collection_compares_with.hpp:132
Definition: pattern_collection_for.hpp:28
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition for compares_with_pattern_collection.
constexpr bool pattern_collection_for
pattern collection P has a shape that is attachable to indexible T.
Definition: pattern_collection_for.hpp:55
constexpr auto to_extents(P &&p)
Convert a pattern_collection to std::extents.
Definition: to_extents.hpp:78
decltype(auto) constexpr get_mdspan(T &&t)
Get the mdspan associated with indexible object T.
Definition: get_mdspan.hpp:35