ServiceHandleAllowed.h
Go to the documentation of this file.
1 #ifndef art_Framework_Services_Registry_detail_ServiceHandleAllowed_h
2 #define art_Framework_Services_Registry_detail_ServiceHandleAllowed_h
3 
4 // ======================================================================
5 // ServiceHandleAllowed is a compile-time trait that checks if a
6 // 'service_handle_allowed' constexpr boolean member is present in a
7 // service's class definition *and* has been set to false. If set to
8 // 'false', then the 'handle_allowed_v<T>' value is 'false'. If a
9 // 'service_handle_allowed' variable is not present in a service's
10 // definition, then the 'handle_allowed_v<T>' value is 'true'.
11 // ======================================================================
12 
13 #include <type_traits>
14 
15 namespace art::detail {
16  template <typename T, typename = void>
17  struct handle_allowed : std::true_type {};
18 
19  template <typename T>
20  struct handle_allowed<T, std::enable_if_t<!T::service_handle_allowed>>
21  : std::false_type {};
22 
23  template <typename T>
25 }
26 
27 #endif /* art_Framework_Services_Registry_detail_ServiceHandleAllowed_h */
28 
29 // Local Variables:
30 // mode: c++
31 // End:
bool constexpr handle_allowed_v
STL namespace.