How can I split an argument pack in two equal parts?
For example, I would like to do something like this:
template<typename T> T sum(const T& t) { return t; } template<typename T> T sum(const T& t1, const T& t2) { return t1 + t2; } template<typename ...T> T sum(T&& ...t) { sum(first_half(t)...) + sum(second_half(t)...); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With