HDembinski · GitHub

@henryiii

…mpatibility
Under C++23 P2255R2 (Type Traits To Detect References Binding To
Temporaries), std::tuple's converting constructor is deleted when a
reference element would bind to a temporary. This broke code that
converts tuple<int> to tuple<const double&>, since the int is
first converted to a temporary double.
Fix: strip cv-qualifiers and reference from the deduced sample
argument types in accumulator_traits. This makes
accumulator_traits<mean<double>>::args == tuple<double> instead of
tuple<const double&>, so the compile-time convertibility check
is_convertible<tuple<int>, tuple<double>> succeeds.
Runtime behavior is unchanged; accumulators still receive arguments
through their const double& parameter.
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Assisted-by: OpenCode:Kimi-K2.6

Read the original on github.com ↗