Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-30 04:05:52

0001 #ifndef FWCore_Framework_interface_es_impl_ReturnArgumentTypes_h
0002 #define FWCore_Framework_interface_es_impl_ReturnArgumentTypes_h
0003 
0004 namespace edm::eventsetup::impl {
0005   template <typename F>
0006   struct ReturnArgumentTypesImpl;
0007 
0008   // function pointer
0009   template <typename R, typename T>
0010   struct ReturnArgumentTypesImpl<R (*)(T const&)> {
0011     using argument_type = T;
0012     using return_type = R;
0013   };
0014 
0015   // mutable functor/lambda
0016   template <typename R, typename T, typename O>
0017   struct ReturnArgumentTypesImpl<R (O::*)(T const&)> {
0018     using argument_type = T;
0019     using return_type = R;
0020   };
0021 
0022   // const functor/lambda
0023   template <typename R, typename T, typename O>
0024   struct ReturnArgumentTypesImpl<R (O::*)(T const&) const> {
0025     using argument_type = T;
0026     using return_type = R;
0027   };
0028 
0029   template <typename F, typename = void>
0030   struct ReturnArgumentTypes;
0031 
0032   template <typename F>
0033   struct ReturnArgumentTypes<F, std::enable_if_t<std::is_class_v<F>>> {
0034     using argument_type = typename ReturnArgumentTypesImpl<decltype(&F::operator())>::argument_type;
0035     using return_type = typename ReturnArgumentTypesImpl<decltype(&F::operator())>::return_type;
0036   };
0037 
0038   template <typename F>
0039   struct ReturnArgumentTypes<F, std::enable_if_t<std::is_pointer_v<F>>> {
0040     using argument_type = typename ReturnArgumentTypesImpl<F>::argument_type;
0041     using return_type = typename ReturnArgumentTypesImpl<F>::return_type;
0042   };
0043 }  // namespace edm::eventsetup::impl
0044 
0045 #endif