1 #ifndef Framework_produce_helpers_h 2 #define Framework_produce_helpers_h 28 namespace produce {
struct Null;}
30 template<
typename FromT,
typename ToT>
void moveFromTo(FromT& iFrom,
35 template<
typename FromT,
typename ToT>
void moveFromTo(std::unique_ptr<FromT>& iFrom, ToT& iTo) {
38 template<
typename FromT,
typename ToT>
void moveFromTo(std::optional<FromT>& iFrom, ToT& iTo) {
45 static_assert((not std::is_pointer_v<T>),
"use std::shared_ptr or std::unique_ptr to hold EventSetup data products, do not use bare pointers");
65 template<
typename T>
struct size {
74 using type =
typename T::element_type;
75 static auto getPointer(
T& iPtr)-> decltype(&*iPtr) {
return &*iPtr;}
81 if(iPtr.has_value()) {
return &*iPtr;}
88 template<
typename HeadT,
typename TailT>
90 if constexpr(not std::is_same_v<TailT,FindT>) {
92 return findIndexOf<
typename container_type::head_type,
93 typename container_type::tail_type>()+1;
98 constexpr static int value = findIndexOf<typename container_type::head_type, typename container_type::tail_type>();
101 template<
typename T>
const char*
name(
const T*);
typename product_traits< T >::type container_type
typename T::element_type type
const char * name(const T *)
static auto getPointer(T &iPtr) -> decltype(&*iPtr)
static T * getPointer(std::optional< T > &iPtr)
void moveFromTo(FromT &iFrom, ToT &iTo)
static constexpr int findIndexOf()
typename product_traits< T >::type type