1 #ifndef Framework_produce_helpers_h
2 #define Framework_produce_helpers_h
32 template <
typename FromT,
typename ToT>
37 template <
typename FromT,
typename ToT>
38 void moveFromTo(std::unique_ptr<FromT>& iFrom, ToT& iTo) {
41 template <
typename FromT,
typename ToT>
51 (not std::is_pointer_v<T>),
52 "use std::shared_ptr or std::unique_ptr to hold EventSetup data products, do not use bare pointers");
89 using type =
typename T::element_type;
90 static auto getPointer(
T& iPtr) -> decltype(&*iPtr) {
return &*iPtr; }
96 static auto getPointer(std::unique_ptr<const T>& iPtr) -> decltype(&*iPtr) {
return &*iPtr; }
102 static auto getPointer(std::shared_ptr<const T>& iPtr) -> decltype(&*iPtr) {
return &*iPtr; }
105 template <
typename T>
109 if (iPtr.has_value()) {
116 template <
typename T,
typename FindT>
119 template <
typename HeadT,
typename TailT>
121 if constexpr (not std::is_same_v<TailT, FindT>) {
123 return findIndexOf<typename container_type::head_type, typename container_type::tail_type>() + 1;
129 findIndexOf<typename container_type::head_type, typename container_type::tail_type>();
132 template <
typename T>
133 const char*
name(
const T*);