KaMPIng 0.2.1
(Near) zero-overhead MPI wrapper for C++
Loading...
Searching...
No Matches
type_helpers.hpp
Go to the documentation of this file.
1// This file is part of KaMPIng.
2//
3// Copyright 2021-2026 The KaMPIng Authors
4//
5// KaMPIng is free software : you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
7// version. KaMPIng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
8// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
9// for more details.
10//
11// You should have received a copy of the GNU Lesser General Public License along with KaMPIng. If not, see
12// <https://www.gnu.org/licenses/>.
13
14/// @file
15/// @brief Internal type helpers for the kamping-types module.
16
17#pragma once
18#include <array>
19#include <cstddef>
20#include <tuple>
21#include <type_traits>
22#include <utility>
23
24namespace kamping::internal {
25
26/// @brief Helper to check if a type is a `std::pair`.
27template <typename T>
28struct is_std_pair : std::false_type {};
29/// @brief Helper to check if a type is a `std::pair`.
30template <typename T1, typename T2>
31struct is_std_pair<std::pair<T1, T2>> : std::true_type {};
32
33/// @brief Helper to check if a type is a `std::tuple`.
34template <typename T>
35struct is_std_tuple : std::false_type {};
36/// @brief Helper to check if a type is a `std::tuple`.
37template <typename... Ts>
38struct is_std_tuple<std::tuple<Ts...>> : std::true_type {};
39
40/// @brief Helper to check if a type is a `std::array`.
41template <typename A>
42struct is_std_array : std::false_type {};
43
44/// @brief Helper to check if a type is a `std::array`.
45template <typename T, size_t N>
46struct is_std_array<std::array<T, N>> : std::true_type {
47 using value_type = T; ///< The type of the elements in the array.
48 static constexpr size_t size = N; ///< The number of elements in the array.
49};
50
51/// @brief Type tag for indicating that no static type definition exists for a type.
53
54} // namespace kamping::internal
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20
STL namespace.
T value_type
The type of the elements in the array.
Definition type_helpers.hpp:47
Helper to check if a type is a std::array.
Definition type_helpers.hpp:42
Helper to check if a type is a std::pair.
Definition type_helpers.hpp:28
Helper to check if a type is a std::tuple.
Definition type_helpers.hpp:35
Type tag for indicating that no static type definition exists for a type.
Definition type_helpers.hpp:52