Liste des Groupes | Revenir à cl c |
Am 28.08.2024 um 15:52 schrieb Thiago Adams:If you put everything on compiler bill, then you don't need move etc..
You have to deallocate only if the ownership still with theTake this code
same object. This is not the case when the object is moved.
string str;
int main ()
{
string str( "hello" );
::str = move( str );
}
With clang-cl (the MSVC-flavour of clang) the whole string-creation
and destruction is opmized away and the compiler directly checks if
::str contains any externally allocated and if not it makes a short
-string-optimized "copy" to ::str. That's nine instructions for the
whole string copy with clang-cl 17.0.3; no external call.
Les messages affichés proviennent d'usenet.