Header-only collection of generic programming tools for C++11.
Note: All classes and functions are work in progress. Interfaces are still likely to change over time and documentation is limited to some comments so far.
static integer sequence needed for variadic initialization/'exploding' something similar (and most likely better engineered) will be in the C++14 standard library
std::function - like wrapper with return value cache
xors std::hash values of tuple arguments together
maps logical AND over a variadic sequence of type traits modeled on std::integral_constant<bool,.>
maps logical OR over a variadic sequence of type traits modeled on std::integral_constant<bool,.>
composes multiple function objects into one
chains calls to 'apply(f_i, args...)' for multiple function objects
returns a copy of an object initialized with n times the same value
returns a copy of an object initialized with n results obtained by n calls to a generator object
returns a copy of an object initialized with n values obtained from n subscript calls (with indices 0...n-1) to a source object
explodes tuple arguments into function arguments
applies a function object to each argument of a tuple of arguments
returns a tuple of results
map(f, {x1,x2,...,xn}) -> {f(x1),f(x2),...,f(xn)}
applies each function object in a tuple to a series of arguments
returns a tuple of results
map({f1,f2,...,fn}, x1,x2,...,xm) -> {f1(x1,...,xm),...,fn(x1,...,xm)}
applies each function_object to each argument 1-by-1
returns a tuple of results
zip_map({f1,f2,...,fn}, {x1,x2,...,xn}) -> {f1(x1),f2(x2),...,fn(xn)}
applies a function object to each argument in a tuple of arguments
discards the results and returns void
for_each_arg(f, {x1,x2,...,xn}): {f(x1); f(x2); ...; f(xn);}
applies each function object to all arguments in turn
discards the results and returns void
for_each_function({f1,f2,...,fn}, x1,x2,...,xm): {f1(x1,...,xm); ...; fn(x1,...,xm);}
applies each function object to each argument 1-by-1
discards the results and returns void
zip_for_each({f1,f2,...,fn}, {x1,x2,...,xn}) {f1(x1); f2(x2); ...; fn(xn);}
- variadic templates
- template aliases
- std::tuple
- std::array
- std::unordered_map
- <chrono>
- <type_traits>
tested with g++ {4.7.2, 5.4, 7.2}, clang++ 5.0.2