Consequently forwards elements of a tuple to a specified binary functor and returns the result.
The function has the same noexcept specifier as a functor applied consequently to the elements of the tuple.
struct ComplexData
{
int n;
double e;
};
struct Functor
{
constexpr double operator()(double x, double y) const noexcept {return x + y;}
constexpr double operator()(double x, int y) const noexcept {return x + y;}
template <class ComplexType>
constexpr auto operator()(double accum, ComplexType&& data) const noexcept {return accum + data.n + data.e;}
};
int main(int, char**)
{
std::cout << eVal << "\n";
return 0;
}
constexpr auto accumulate(Tpl &&tpl, BinOp &&binop) noexcept(noexcept(Implementation::accumulate(std::declval< Tpl && >(), std::declval< BinOp && >(), std::integral_constant< std::size_t, std::tuple_size< typename std::remove_reference< Tpl >::type >::value >()))) -> decltype(Implementation::accumulate(std::declval< Tpl && >(), std::declval< BinOp && >(), std::integral_constant< std::size_t, std::tuple_size< typename std::remove_reference< Tpl >::type >::value >()))
Consequently forwards elements of a tuple to a specified binary functor and returns the result.
Definition: chsvmath.h:541