ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SourceLinkConcept.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SourceLinkConcept.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 
12 
13 #include <type_traits>
14 
15 namespace Acts {
16 
17 class Surface;
18 
19 namespace concept {
20  namespace detail_slc {
21  template <typename T>
22  using comparable_t = decltype(std::declval<T>() == std::declval<T>());
23 
24  template <typename T>
25  using dereferenceable_t = decltype(*std::declval<T>());
26 
27  template <typename T>
28  using surface_method_t = decltype(std::declval<T>().referenceSurface());
29 
30  template <typename T>
32  constexpr static bool comparison_works =
33  identical_to<bool, comparable_t, T>;
34  static_assert(comparison_works,
35  "Source link does not implement equality operator");
36 
37  constexpr static bool surface_method_exists =
38  converts_to<const Surface&, surface_method_t, T>;
39  static_assert(
41  "Source link does not have compliant referenceSurface method");
42 
43  constexpr static bool copyable = std::is_copy_constructible_v<T>;
44  static_assert(copyable, "Source link must be copy constructible");
45 
46  constexpr static bool default_constructible =
47  std::is_default_constructible_v<T>;
48  static_assert(default_constructible,
49  "Source link must be default-constructible");
50 
51  constexpr static bool value =
54  };
55  } // namespace detail_slc
56 } // namespace concept
57 template <typename T>
58 constexpr bool SourceLinkConcept =
60 } // namespace Acts