C++ Logo

std-proposals

Advanced search

[std-proposals] Defect report for std::apply (or apply_perfectly)

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sun, 10 Mar 2024 10:37:36 +0000
std::apply works as follows:

    return invoke(std::forward<F>(f),
std::get<I>(std::forward<Tuple>(t))...);

If one of the types in the tuple is an Rvalue reference, it becomes an
Lvalue. I can't imagine that this was intentional.

I have written my own function called 'apply_perfectly' which takes the
return value from 'get' and uses 'static_cast' to cast it to the type of
the tuple element, thereby achieving perfect forwarding.

So my question is as follows, which should I do?

A) Write a defect report for std::apply
B) Write a new paper for std::apply_perfectly

Received on 2024-03-10 10:37:39