Wird NRVO garantiert auf den Bau der Mitglieder einer Struktur angewendet?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wird NRVO garantiert auf den Bau der Mitglieder einer Struktur angewendet?

by Anonymous » 03 Apr 2025, 09:38

Ich weiß, dass der Fooresult selbst direkt im Rückgabereicherspeicherort konstruiert ist. Ich vermute, dies ist wirklich nur ein Fall typischer Bewegungskonstruktion, aber gibt es Garantien dafür, dass seine Mitglieder bewegt werden?

Code: Select all

struct FooResult {
MoveConstructibleType x;
};

FooResult foo()
{
MoveConstructibleType x;
// do some stuff computing x...
return FooResult {.x = x}; // is the construction of x guaranteed to be move constructed?
}

Top