Date: Fri, 17 Nov 2023 12:49:58 +0400
Hi Giuseppe,
Thank you for your explanation.
I cannot provide a specific use case for it, but my point is that there is
a definition like this:
init-statementopt auto &&range = for-range-initializer;
and then there are `range.begin()` / `range.end()` calls which ignore the
value category of the expression. This seemed weird to me. I think if there
were a single function to get `begin()` and `end()` like this:
std::pair<Iter, Iter> begin_end() &&; it would be okay.
Also worth noting is that the use-after-move has some well-defined
behaviors in the standard, for example
*unique_ptr(unique_ptr&& u) noexcept;*
- *Postconditions*: get() yields the value u.get() yielded before the
construction. *u.get() == nullptr*. get_deleter() returns a reference
to the stored deleter that was constructed from u.get_deleter(). *If D is a
reference type then get_deleter() and u.get_deleter() both reference the
same lvalue deleter.*
and this means that there can be some special cases.
Best regards,
Ghevond
Thank you for your explanation.
I cannot provide a specific use case for it, but my point is that there is
a definition like this:
init-statementopt auto &&range = for-range-initializer;
and then there are `range.begin()` / `range.end()` calls which ignore the
value category of the expression. This seemed weird to me. I think if there
were a single function to get `begin()` and `end()` like this:
std::pair<Iter, Iter> begin_end() &&; it would be okay.
Also worth noting is that the use-after-move has some well-defined
behaviors in the standard, for example
*unique_ptr(unique_ptr&& u) noexcept;*
- *Postconditions*: get() yields the value u.get() yielded before the
construction. *u.get() == nullptr*. get_deleter() returns a reference
to the stored deleter that was constructed from u.get_deleter(). *If D is a
reference type then get_deleter() and u.get_deleter() both reference the
same lvalue deleter.*
and this means that there can be some special cases.
Best regards,
Ghevond
Received on 2023-11-17 08:50:10