Funktion doppelt zu std :: Move?

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: Funktion doppelt zu std :: Move?

by Anonymous » 12 Mar 2025, 03:57

Nehmen wir an, ich habe eine Klasse mit nur einem Konstruktor: < /p>

Code: Select all

class T {
public:
T(BigClass&& big) : big(std::move(big)) {}
...

SomeBigClass
};
< /code>

An den meisten Orten wird der Konstruktor vorübergehend aufgerufen, aber an einem Ort muss ich eine explizite Kopie von BigClass erstellenvoid foo(const BigClass& big) {
while (...) {
T t(std::make_a_copy(big));
...
}
}
Gibt es eine Funktion "Dual" zu std :: move in C ++ 11 oder C ++ 14, die make_a_copy oben ersetzen würde?>

Top