lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Conversion from class html::text


From: Greg Chicares
Subject: Re: [lmi] Conversion from class html::text
Date: Tue, 13 Feb 2018 01:03:21 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 2018-02-04 13:47, Vadim Zeitlin wrote:
> 

[I've applied your patch from
  http://lists.nongnu.org/archive/html/lmi/2018-02/msg00009.html
and adjusted the comment on the "move-accessor".]

> [...] unfortunately in C++ you
> can perfectly well do something like this:
> 
>       html::text h{...};
>       std::string s = std::move(h).as_html();
>       s += std::move(h).as_html();
> 
> i.e. move from "h" twice (this is, BTW, the fundamental difference between
> C++ and Rust, where the semantics are the same, but the above is a
> compile-time error). But this is something that has to be done explicitly
> and should normally never happen because a variable that was moved from
> must simply not be used ever again.
std::move()'s name must not be interpreted literally. It's doesn't
actually move anything: it's actually a cast. If we read it as
  "this object is about to be swapped into the Oort cloud"
then we'll hesitate to try using it again later.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]