Date: Wed, 4 Jun 2025 09:58:16 +0200
Well the current solutions are insufficient because they are
non-existent...
Consider this class:
struct StringWrapper
{
// [...]
[[nodiscard]] explicit operator std::string&&(void) && noexcept {
return std::move(this->_value); }
private:
std::string _value;
};
I would want to perform that conversion like that:
C c = AcquireC();
const auto myString = std::move_as<std::string>(c);
Tymi.
On Wed, Jun 4, 2025 at 6:36 AM Jan Schultke <janschultke_at_[hidden]>
wrote:
> How is it supposed to perform a conversion and return an rvalue
> reference? This looks like you're returning a reference to a temporary
> object.
>
non-existent...
Consider this class:
struct StringWrapper
{
// [...]
[[nodiscard]] explicit operator std::string&&(void) && noexcept {
return std::move(this->_value); }
private:
std::string _value;
};
I would want to perform that conversion like that:
C c = AcquireC();
const auto myString = std::move_as<std::string>(c);
Tymi.
On Wed, Jun 4, 2025 at 6:36 AM Jan Schultke <janschultke_at_[hidden]>
wrote:
> How is it supposed to perform a conversion and return an rvalue
> reference? This looks like you're returning a reference to a temporary
> object.
>
Received on 2025-06-04 07:58:26