50 #ifndef LIB_META_TUPLE_HELPER_H 51 #define LIB_META_TUPLE_HELPER_H 81 template<
class FUN,
typename...ELMS>
82 void forEach (std::tuple<ELMS...>&& tuple, FUN fun)
84 std::apply ([&fun](
auto&... elms)
95 template<
typename SEQ>
100 template<
typename...TYPES>
103 using Type = std::tuple<TYPES...>;
110 template<
typename...TYPES>
118 template<
class H,
typename TAIL>
141 template<
typename TYPES>
142 using Tuple =
typename BuildTupleType<TYPES>::Type;
145 using std::tuple_size;
146 using std::tuple_element;
151 template<
typename...TYPES>
154 using Seq =
typename Types<TYPES...>::Seq;
155 using List =
typename Seq::List;
157 template<
typename...TYPES>
160 using Seq =
typename Types<TYPES...>::Seq;
161 using List =
typename Seq::List;
171 template<
typename...TYPES>
202 template<
typename TYPES
203 ,
template<
class,
class,
size_t>
class _ElmMapper_
212 template<
class SRC,
size_t...idx>
214 :
Tuple<TYPES> (_ElmMapper_<SRC,
Tuple<TYPES>, idx>{values}...)
234 template<
class SRC,
class TAR>
238 template<
class SRC,
class TAR,
size_t i>
251 template<
typename TYPES,
class SRC>
284 <
template<
class,
class,
class, u
int>
class _X_
309 <
template<
class,
class,
class, u
int>
class _X_
316 using Product = _X_<NullType, TUP, TUP, i>;
340 dump (std::string
const& prefix =
"(")
const 342 return BASE::dump (prefix + util::toString(std::get<idx>(*
this))+
",");
346 template<
class TUP, u
int n>
355 dump (std::string
const& prefix =
"(")
const 357 if (1 < prefix.length())
359 return prefix.substr (0, prefix.length()-1) +
")";
374 template<
typename...TYPES>
376 dump (std::tuple<TYPES...>
const& tuple)
379 using Displayer =
typename BuildAccessor::Product ;
381 return static_cast<Displayer const&
> (tuple)
393 template<
typename...TYPES>
397 invoke (std::tuple<TYPES...>
const& tuple) noexcept
399 return "«"+typeStr(tuple)
400 +
"»──" + lib::meta::dump (tuple);
402 catch(...) {
return FAILURE_INDICATOR; }
A template metaprogramming technique for manipulating collections of types.
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
Metaprogramming: simple helpers for working with lists-of-types.
Some basic facilities for manipulating type sequences.
Tuple< TYPES > buildTuple(SRC values)
convenience shortcut to build a tuple from some suitable source data.
Implementation namespace for support and library code.
void forEach(std::tuple< ELMS... > &&tuple, FUN fun)
Helper: perform some arbitrary operation on each element of a tuple.
failsafe invocation of custom string conversion.
Metaprogramming with type sequences based on variadic template parameters.
std::string dump(std::tuple< TYPES... > const &tuple)
convenience function to dump a given tuple's contents.