Date: Tue, 21 Oct 2025 16:09:04 +0200
With RVO we would not need copy or move.
-----Ursprüngliche Nachricht-----
Von:SD SH via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Di 21.10.2025 14:02
Betreff:Re: [std-proposals] Forwarding Reference can also accept PRvalue (not just Lvalue or Rvalue)
An:std-proposals_at_[hidden];
CC:SD SH <Z5515zwy_at_[hidden]>;
Then how will you implement it?
Think of this:
```
SYSCLASS struct Accessor; // unmovable and uncopyable
extern SYSAPI Accessor (*access)();
int main() {
StoreAndGet<Accessor>(access());
}
```
We don't know what the function will do, and it's impossible to change the function. We only know that access() will construct a Accessor object and follow the calling convention, then we must call copy or move constructor, but in this case we can't do it.
For your example, if a function returns a unmovable and uncopyable object means that you shouldn't construct it by existing objects in your code.
Received on 2025-10-21 14:22:02
