Part 1: print std::array with std:integer_sequence
Part 2: convert tuple to parameter pack
Part 3: print std::array or std::tuple with std::apply and fold
Part 4: fold over std::tuple und erzeugten Assembler Code
Part 5: fold over std::tuple of std::vector of Types ...
Part 6: apply generic lambda to tuple
Part 7: Play with std::tuple and std::apply
Da ein std::array eigentlich auch nur so etwas wie ein tuple ist, nur nicht mit unterschiedlichen Typen, kann die ganze parameter pack und fold Sache auch auf std::array angewandt werden.
template<typename T, size_t N> std::ostream& operator<<(std::ostream& s, const std::array<T,N>& arr) { std::apply([&](const auto&...v){ (s << ... << v); }, arr); return s; } void func(const std::array<double,2>& arr) { std::cout << arr; }
Ja, eigentlich ganz hübsch.