Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-02-21 00:31:26

0001 #ifndef FWCore_Framework_interface_es_impl_ReturnArgumentTypes_h
0002 #define FWCore_Framework_interface_es_impl_ReturnArgumentTypes_h
0003 
0004 namespace edm {
0005   class WaitingTaskWithArenaHolder;
0006 
0007   namespace eventsetup::impl {
0008     template <typename F>
0009     struct ReturnArgumentTypesImpl;
0010 
0011     // function pointer
0012     template <typename R, typename T>
0013     struct ReturnArgumentTypesImpl<R (*)(T const&)> {
0014       using argument_type = T;
0015       using return_type = R;
0016     };
0017     template <typename R, typename T>
0018     struct ReturnArgumentTypesImpl<R (*)(T const&, WaitingTaskWithArenaHolder)> {
0019       using argument_type = T;
0020       using return_type = R;
0021     };
0022 
0023     // mutable functor/lambda
0024     template <typename R, typename T, typename O>
0025     struct ReturnArgumentTypesImpl<R (O::*)(T const&)> {
0026       using argument_type = T;
0027       using return_type = R;
0028     };
0029     template <typename R, typename T, typename O>
0030     struct ReturnArgumentTypesImpl<R (O::*)(T const&, WaitingTaskWithArenaHolder)> {
0031       using argument_type = T;
0032       using return_type = R;
0033     };
0034 
0035     // const functor/lambda
0036     template <typename R, typename T, typename O>
0037     struct ReturnArgumentTypesImpl<R (O::*)(T const&) const> {
0038       using argument_type = T;
0039       using return_type = R;
0040     };
0041     template <typename R, typename T, typename O>
0042     struct ReturnArgumentTypesImpl<R (O::*)(T const&, WaitingTaskWithArenaHolder) const> {
0043       using argument_type = T;
0044       using return_type = R;
0045     };
0046 
0047     //////////
0048 
0049     template <typename F, typename = void>
0050     struct ReturnArgumentTypes;
0051 
0052     template <typename F>
0053     struct ReturnArgumentTypes<F, std::enable_if_t<std::is_class_v<F>>> {
0054       using argument_type = typename ReturnArgumentTypesImpl<decltype(&F::operator())>::argument_type;
0055       using return_type = typename ReturnArgumentTypesImpl<decltype(&F::operator())>::return_type;
0056     };
0057 
0058     template <typename F>
0059     struct ReturnArgumentTypes<F, std::enable_if_t<std::is_pointer_v<F>>> {
0060       using argument_type = typename ReturnArgumentTypesImpl<F>::argument_type;
0061       using return_type = typename ReturnArgumentTypesImpl<F>::return_type;
0062     };
0063 
0064   }  // namespace eventsetup::impl
0065 }  // namespace edm
0066 
0067 #endif