1 #ifndef fhiclcpp_types_OptionalTupleAs_h 2 #define fhiclcpp_types_OptionalTupleAs_h 20 template <
typename T,
typename... ARGS>
21 class OptionalTupleAs;
23 template <
typename T,
typename... ARGS>
30 std::function<
bool()> maybeUse);
32 template <std::size_t... I>
35 std::index_sequence<I...>)
const 37 return T{std::get<I>(via)...};
45 auto tmp =
fill(via, std::index_sequence_for<ARGS...>{});
46 std::swap(result,
tmp);
55 return tupleObj_.hasValue();
64 std::string
const preface =
65 "N.B. The following sequence is converted to type:";
66 std::string
const name =
67 " '" + cet::demangle_symbol(
typeid(T).name()) +
"'";
68 std::string
const user_comment =
69 comment.
value.empty() ?
"" :
"\n\n" + comment.value;
71 std::ostringstream oss;
72 oss << preface <<
'\n' << name << user_comment;
74 return Comment{oss.str().c_str()};
81 template <
typename T,
typename... ARGS>
86 template <
typename T,
typename... ARGS>
88 : tupleObj_{std::move(name), conversion_comment(std::move(comment))}
91 template <
typename T,
typename... ARGS>
94 std::function<
bool()> maybeUse)
95 : tupleObj_{std::move(name),
96 conversion_comment(std::move(comment)),
Comment conversion_comment(Comment &&comment) const
bool operator()(T &result) const
OptionalTuple< ARGS... > tupleObj_
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
T fill(typename OptionalTuple< ARGS... >::value_type const &via, std::index_sequence< I... >) const