Hacker News new | ask | show | jobs
by account42 2154 days ago
Not that complicated even in C++

template <typename... Lists, typename Func> auto map(Func && func, Lists &&... lists) -> std::vector<decltype(func(std::declval<typename std::decay<Lists>::type::value_type>()...))>;

1 comments

> std::declval<typename std::decay<Lists>::type::value_type>()

Yes, nothing hard to understand or discover about that at all...

Replying to add: actually, not only is the type obscure, it also relies on knowing the lists at compile time, while the CL function can do this at runtime (note that there is no dynamic behavior, it's simply that C++'s type system can't abstract over function arity).