HDTree  0.5.2
HDTree C++ API
ClassVersion.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 namespace hdtree {
9 
15 namespace class_version_impl {
16 
25 template <class T, class R = void>
27  using type = R;
28 };
29 
40 template <class T, class Enable = void>
41 struct deducer {
42  using version = std::integral_constant<int, 0>;
43 };
44 
56 template <class T>
57 struct deducer<T, typename enable_if_type<typename T::version>::type> {
58  using version = typename T::version;
59 };
60 
61 } // namespace class_version_impl
62 
72 template <typename T>
73 inline constexpr int class_version =
75 
76 } // namespace hdtree
77 
85 #define hdtree_class_version(VERS) \
86  using version = std::integral_constant<int, VERS>
Geant4 does a GLOBAL definition of the keyword TRUE.
Definition: Atomic.cxx:3
constexpr int class_version
Helper const expression to pull out class version number.
Definition: ClassVersion.h:73
Underlying struct deducing the version of a class.
Definition: ClassVersion.h:41
Check if the passed type T is a valid type at compile time.
Definition: ClassVersion.h:26