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 Concepts {
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 = identical_to<bool, comparable_t, T>;
33  static_assert(comparison_works,
34  "Source link does not implement equality operator");
35 
36  constexpr static bool surface_method_exists =
37  converts_to<const Surface&, surface_method_t, T>;
38  static_assert(surface_method_exists,
39  "Source link does not have compliant referenceSurface method");
40 
41  constexpr static bool copyable = std::is_copy_constructible_v<T>;
42  static_assert(copyable, "Source link must be copy constructible");
43 
44  constexpr static bool default_constructible =
45  std::is_default_constructible_v<T>;
46  static_assert(default_constructible,
47  "Source link must be default-constructible");
48 
49  constexpr static bool value =
52 };
53 } // namespace detail_slc
54 } // namespace Concepts
55 template <typename T>
56 constexpr bool SourceLinkConcept =
58 } // namespace Acts