1 #ifndef fhiclcpp_types_TupleAs_h 2 #define fhiclcpp_types_TupleAs_h 23 template <
typename T,
typename... ARGS>
26 template <
typename T,
typename... ARGS>
38 std::function<
bool()> maybeUse);
45 std::function<
bool()> maybeUse,
52 return tupleObj_(via) ? std::make_from_tuple<T>(via) :
53 tupleObj_.has_default() ?
80 template <
typename T,
typename... ARGS>
85 template <
typename T,
typename... ARGS>
87 : tupleObj_{std::move(name), conversion_comment(std::move(comment))}
92 template <
typename T,
typename... ARGS>
95 std::function<
bool()> maybeUse)
96 : tupleObj_{std::move(name),
97 conversion_comment(std::move(comment)),
104 template <
typename T,
typename... ARGS>
109 template <
typename T,
typename... ARGS>
111 : tupleObj_{std::move(name), conversion_comment(std::move(comment), t)}
112 , t_{std::make_shared<T>(t)}
117 template <
typename T,
typename... ARGS>
120 std::function<
bool()> maybeUse,
122 : tupleObj_{std::move(name),
123 conversion_comment(std::move(comment), t),
125 , t_{std::make_shared<T>(t)}
132 template <
typename T,
typename... ARGS>
136 std::string
const preface =
137 "N.B. The following sequence is converted to type:";
138 std::string
const name =
139 " '" + cet::demangle_symbol(
typeid(T).name()) +
"'";
140 std::string
const user_comment =
141 comment.value.empty() ?
"" :
"\n\n" + comment.value;
143 std::ostringstream oss;
144 oss << preface <<
'\n' << name << user_comment;
145 return Comment{oss.str().c_str()};
148 template <
typename T,
typename... ARGS>
152 std::string
const preface{
153 "N.B. The following sequence is converted to type:"};
154 std::string
const name{
" '" +
155 cet::demangle_symbol(
typeid(T).name()) +
"'"};
157 std::string
const user_comment{
158 comment.value.empty() ?
"" :
"\n\n" + comment.value};
160 std::ostringstream oss;
161 oss << preface <<
'\n' 164 return Comment{oss.str().c_str()};
std::string maybe_insert(T const &t)
typename OptionalTuple< ARGS... >::ftype ftype
typename OptionalTuple< ARGS... >::value_type via_type
OptionalTuple< ARGS... > tupleObj_
cet::coded_exception< error, detail::translate > exception