KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kabool.hpp
1// This file is part of KaMPIng.
2//
3// Copyright 2021-2024 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#pragma once
15namespace kamping {
16/// @brief Wrapper around bool to allow handling containers of boolean values
17class kabool {
18public:
19 /// @brief default constructor for a \c kabool with value \c false
20 constexpr kabool() noexcept : _value() {}
21 /// @brief constructor to construct a \c kabool out of a \c bool
22 constexpr kabool(bool value) noexcept : _value(value) {}
23
24 /// @brief implicit cast of \c kabool to \c bool
25 inline constexpr operator bool() const noexcept {
26 return _value;
27 }
28
29private:
30 bool _value; /// < the wrapped boolean value
31};
32} // namespace kamping
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Wrapper around bool to allow handling containers of boolean values.
Definition kabool.hpp:17
constexpr kabool(bool value) noexcept
constructor to construct a kabool out of a bool
Definition kabool.hpp:22
constexpr kabool() noexcept
default constructor for a kabool with value false
Definition kabool.hpp:20