Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:09

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include <concepts>
0012 #include <functional>
0013 #include <type_traits>
0014 
0015 namespace Acts::Concepts {
0016 /// @brief Concept that is true if T is the same as any of Ts.
0017 template <typename T, typename... Ts>
0018 concept same_as_any_of = (std::same_as<T, Ts> || ...);
0019 
0020 /// @brief Concept that is equivalent to `is_nothrow_move_constructible`.
0021 /// @todo Convert this to a "real" concept.
0022 template <typename T>
0023 concept nothrow_move_constructible = std::is_nothrow_move_constructible_v<T>;
0024 
0025 /// @brief Concept that is true if T is an arithmetic type.
0026 template <typename T>
0027 concept arithmetic = std::integral<T> || std::floating_point<T>;
0028 
0029 /// @brief Concept that is satisfied iff both of its arguments decay to the
0030 /// same type.
0031 template <typename T1, typename T2>
0032 concept decayed_same_as = std::same_as<std::decay_t<T1>, std::decay_t<T2> >;
0033 
0034 /// @brief Concept that is satisfied iff type T is callable with arguments
0035 /// Args... and returns type U
0036 template <auto Callable, typename U, typename... Args>
0037 concept invocable_and_returns = requires(Args... args) {
0038   { std::invoke(Callable, args...) } -> std::same_as<U>;
0039 };
0040 }  // namespace Acts::Concepts