EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
action_signature_check.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file action_signature_check.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 #include <type_traits>
11 
12 namespace Acts {
13 
40 namespace detail {
41 
42 namespace {
43 
44 template <typename T, typename propagator_state_t, typename stepper_t,
45  typename result_t,
46  typename = decltype(std::declval<T>().operator()(
47  std::declval<propagator_state_t&>(), std::declval<stepper_t&>(),
48  std::declval<result_t&>()))>
49 std::true_type test_action_with_result(int);
50 
51 template <typename, typename, typename, typename>
52 std::false_type test_action_with_result(...);
53 
54 template <typename T, typename propagator_state_t, typename stepper_t,
55  typename = decltype(std::declval<T>().operator()(
56  std::declval<propagator_state_t&>(), std::declval<stepper_t&>()))>
57 std::true_type test_action_without_result(int);
58 
59 template <typename>
60 std::false_type test_action_without_result(...);
61 
62 template <typename T, typename propagator_state_t, typename stepper_t,
63  bool has_result = false>
64 struct action_signature_check_impl
65  : decltype(
66  test_action_without_result<T, propagator_state_t, stepper_t>(0)) {};
67 
68 template <typename T, typename propagator_state_t, typename stepper_t>
69 struct action_signature_check_impl<T, propagator_state_t, stepper_t, true>
70  : decltype(test_action_with_result<T, propagator_state_t, stepper_t,
71  detail::result_type_t<T>>(0)) {};
72 
73 template <typename T, typename propagator_state_t, typename stepper_t>
74 struct action_signature_check
75  : action_signature_check_impl<T, propagator_state_t, stepper_t,
76  detail::has_result_type_v<T>> {};
77 } // end of anonymous namespace
78 
79 template <typename T, typename propagator_state_t, typename stepper_t>
80 constexpr bool action_signature_check_v =
82 } // namespace detail
83 
84 } // namespace Acts