<div dir="auto">The U&amp; is a typo, U&amp;&amp; would be the correct one. Wrote that one on the fly<div dir="auto"><br></div><div dir="auto">Tymi.</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, 4 Jun 2025, 12:54 Tymi, &lt;<a href="mailto:tymi.cpp@gmail.com">tymi.cpp@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Same reason why std::move exists<div dir="auto">Why do we have std::move? Why not just use static_cast&lt;T&amp;&amp;&gt;(value)?</div><div dir="auto"><br></div><div dir="auto">Tymi.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 4 Jun 2025, 12:19 Jonathan Wakely, &lt;<a href="mailto:cxx@kayari.org" target="_blank" rel="noreferrer">cxx@kayari.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 4 Jun 2025, 10:14 Tymi, &lt;<a href="mailto:tymi.cpp@gmail.com" rel="noreferrer noreferrer" target="_blank">tymi.cpp@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div>
    <p>&quot;moving&quot; meaning &quot;using std::move&quot; meaning casting to an rvalue
      reference, let&#39;s not point such things out when we know what we
      are talking about :/</p>
    <p><br>
    </p>
    <p>&gt; I don&#39;t think your std:: expected example works, it didn&#39;t
      have a conversion operator. What you want is just std:: move(*exp)
      or *std::move(exp).</p>
    <p>My std::expected example does not currently work, but
      std::move_as opens a possibility for std::expected to implement
      such a conversion. std::move(*myExpected) works, but
      std::move_as&lt;Value&gt;(myExpected) seems cleaner to me.</p></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">It seems more verbose and completely unnecessary when you can already achieve the same thing. </div><div dir="auto"><br></div><div dir="auto">Not being convertible to its result is an intentional design choice for expected (and for optional) so changing that to enable your new feature seems like a bad trade off.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
    <p>&gt; And your string example works with just
      static_cast&lt;std::string&amp;&amp;&gt;(obj).</p>
    <p>And no, static_cast&lt;std::string&amp;&amp;&gt;(obj) does not
      work.</p></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Oh right, your conversion is &amp;&amp; qualified. So static_cast&lt;string&amp;&amp;&gt;(std::move(obj))</div><div dir="auto"><br></div><div dir="auto">I still see no need to introduce a new feature to do this. </div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
    <div>On 04.06.2025 11:08, Jonathan Wakely
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="auto">
        <div><br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Wed, 4 Jun 2025, 09:03
              Tymi via Std-Proposals, &lt;<a href="mailto:std-proposals@lists.isocpp.org" rel="noreferrer noreferrer noreferrer" target="_blank">std-proposals@lists.isocpp.org</a>&gt;
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">I find the move_as example more intuitive
                and generally &quot;safer&quot;. Also my first thought was that
                std::string(std::move(c)) copied c._value and created a
                new object out of it, instead of just moving c._value.</div>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">You seem to be saying &quot;moving&quot; when you mean
          &quot;casting to rvalue reference&quot;, which is not moving. </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I don&#39;t think your std:: expected example works,
          it didn&#39;t have a conversion operator. What you want is just
          std:: move(*exp) or *std::move(exp).</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">And your string example works with just
          static_cast&lt;std::string&amp;&amp;&gt;(obj).</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">So I think the existing solutions are fine. </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto"><br>
        </div>
      </div>
    </blockquote>
  </div>

</blockquote></div></div></div>
</blockquote></div>
</blockquote></div>

