[Codewars] Tuple sum

Tuple sum

  • Time :
  • Space :
1
2
3
4
5
6
#include <tuple>

template <typename... Ts>
double tuple_sum(const std::tuple<Ts...>& tpl) {
return std::get<int>(tpl) + std::get<double>(tpl);
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2023/06/08/PS/Codewars/tuple-sum/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.