Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [C++] Move semantics (C++11)

    Ciao a tutti.

    Il seguente codice compila:
    codice:
    Vettore Molla::evoluzione() const
    {
    	Vettore r( (1 / massa) * (forza * direzione - k * omega[0] - b * omega_[0]) );
    
    	return std::move(r);
    }
    Ma fa quello che voglio? Oppure devo scriverlo nel modo seguente:
    codice:
    Vettore&& Molla::evoluzione() const
    {
    	Vettore r( (1 / massa) * (forza * direzione - k * omega[0] - b * omega_[0]) );
    
    	return std::move(r);
    }
    Grazie,
    R.
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

  2. #2
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    E' sufficiente la prima versione.
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

  3. #3
    Originariamente inviato da shodan
    E' sufficiente la prima versione.
    Perfetto, grazie! =).
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.