Combine multiple vectors (results of function) into one with template
I'd like to have a templated function taking in a vector<T> v and a function op, mapping T to vector<U> and would like to concatenate the results of applying f to every element vector of v to return a vector<U> = [ Elements of op(v[0]), Elements of op(v[1]) ...]. A working option I found was adding an example in the function to allow for template deduction: template <typename Container> Container& concat(Container& c1, Container const& c2) { c1.insert(end(c1), begin(c2), end(c2)); return c1; } template <typename Container, typename UnaryOperation, typename U> inline auto to_vec_from_vectors