@@ -86,119 +86,6 @@ namespace edm {
8686 std::type_info const & operator ()() { return typeid (T); }
8787 };
8888
89- // bool isMergeable_() will return true if T::mergeProduct(T const&) is declared and false otherwise
90- // bool mergeProduct_(WrapperBase const*) will merge products if T::mergeProduct(T const&) is defined
91- // Definitions for the following struct and function templates are not needed; we only require the declarations.
92- template <typename T, bool (T::*)(T const &)>
93- struct mergeProduct_function ;
94- template <typename T>
95- static yes_tag has_mergeProduct (mergeProduct_function<T, &T::mergeProduct>* dummy);
96- template <typename T>
97- static no_tag has_mergeProduct (...);
98-
99- template <typename T>
100- struct has_mergeProduct_function {
101- static constexpr bool value = std::is_same<decltype (has_mergeProduct<T>(nullptr )), yes_tag>::value;
102- };
103-
104- template <typename T, bool = has_mergeProduct_function<T>::value>
105- struct getHasMergeFunction ;
106- template <typename T>
107- struct getHasMergeFunction <T, true > {
108- bool operator ()() { return true ; }
109- };
110- template <typename T>
111- struct getHasMergeFunction <T, false > {
112- bool operator ()() { return false ; }
113- };
114- template <typename T, bool = has_mergeProduct_function<T>::value>
115- struct doMergeProduct ;
116- template <typename T>
117- struct doMergeProduct <T, true > {
118- bool operator ()(T& thisProduct, T const & newProduct) { return thisProduct.mergeProduct (newProduct); }
119- };
120- template <typename T>
121- struct doMergeProduct <T, false > {
122- bool operator ()(T& thisProduct, T const & newProduct) {
123- return true ; // Should never be called
124- }
125- };
126-
127- // bool hasIsProductEqual_() will return true if T::isProductEqual(T const&) const is declared and false otherwise
128- // bool isProductEqual _(WrapperBase const*) will call T::isProductEqual(T const&) if it is defined
129- // Definitions for the following struct and function templates are not needed; we only require the declarations.
130- template <typename T, bool (T::*)(T const &) const >
131- struct isProductEqual_function ;
132- template <typename T>
133- static yes_tag has_isProductEqual (isProductEqual_function<T, &T::isProductEqual>* dummy);
134- template <typename T>
135- static no_tag has_isProductEqual (...);
136-
137- template <typename T>
138- struct has_isProductEqual_function {
139- static constexpr bool value = std::is_same<decltype (has_isProductEqual<T>(nullptr )), yes_tag>::value;
140- };
141-
142- template <typename T, bool = has_isProductEqual_function<T>::value>
143- struct getHasIsProductEqual ;
144- template <typename T>
145- struct getHasIsProductEqual <T, true > {
146- bool operator ()() { return true ; }
147- };
148- template <typename T>
149- struct getHasIsProductEqual <T, false > {
150- bool operator ()() { return false ; }
151- };
152- template <typename T, bool = has_isProductEqual_function<T>::value>
153- struct doIsProductEqual ;
154- template <typename T>
155- struct doIsProductEqual <T, true > {
156- bool operator ()(T const & thisProduct, T const & newProduct) { return thisProduct.isProductEqual (newProduct); }
157- };
158- template <typename T>
159- struct doIsProductEqual <T, false > {
160- bool operator ()(T const & thisProduct, T const & newProduct) {
161- return true ; // Should never be called
162- }
163- };
164-
165- // bool hasSwap_() will return true if T::swap(T&) is declared and false otherwise
166- // void swapProduct_() will call T::swap(T&) if it is defined otherwise it does nothing
167- // Definitions for the following struct and function templates are not needed; we only require the declarations.
168- template <typename T, void (T::*)(T&)>
169- struct swap_function ;
170- template <typename T>
171- static yes_tag has_swap (swap_function<T, &T::swap>* dummy);
172- template <typename T>
173- static no_tag has_swap (...);
174-
175- template <typename T>
176- struct has_swap_function {
177- static constexpr bool value = std::is_same<decltype (has_swap<T>(nullptr )), yes_tag>::value;
178- };
179-
180- template <typename T, bool = has_swap_function<T>::value>
181- struct getHasSwapFunction ;
182- template <typename T>
183- struct getHasSwapFunction <T, true > {
184- bool operator ()() { return true ; }
185- };
186- template <typename T>
187- struct getHasSwapFunction <T, false > {
188- bool operator ()() { return false ; }
189- };
190- template <typename T, bool = has_swap_function<T>::value>
191- struct doSwapProduct ;
192- template <typename T>
193- struct doSwapProduct <T, true > {
194- void operator ()(T& thisProduct, T& newProduct) { thisProduct.swap (newProduct); }
195- };
196- template <typename T>
197- struct doSwapProduct <T, false > {
198- void operator ()(T&, T&) {
199- return ; // Should never be called
200- }
201- };
20289 } // namespace detail
20390} // namespace edm
20491#endif
0 commit comments