Pass constant parameter by reference to load_operations() (#788814)

It is common C++ practice to pass a constant object by reference to
avoid constructing a duplicate object for pass by value [1].

[1] How to pass objects to functions in C++?
    https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c/2139254#2139254

Bug 788814 - gparted-0.30.0/include/HBoxOperations.h:37]: performance
             problem
This commit is contained in:
Mike Fleetwood 2019-03-28 16:26:00 +00:00 committed by Curtis Gedak
parent 56d8533add
commit 97ce96da03
2 changed files with 3 additions and 2 deletions

View File

@ -34,7 +34,7 @@ public:
HBoxOperations() ; HBoxOperations() ;
~HBoxOperations() ; ~HBoxOperations() ;
void load_operations( const std::vector<Operation *> operations ) ; void load_operations(const std::vector<Operation *>& operations);
void clear() ; void clear() ;
sigc::signal< void > signal_undo ; sigc::signal< void > signal_undo ;

View File

@ -68,7 +68,8 @@ HBoxOperations::HBoxOperations()
Gtk::Stock::CLOSE, sigc::mem_fun(*this, &HBoxOperations::on_close)))); Gtk::Stock::CLOSE, sigc::mem_fun(*this, &HBoxOperations::on_close))));
} }
void HBoxOperations::load_operations( const std::vector<Operation *> operations )
void HBoxOperations::load_operations(const std::vector<Operation *>& operations)
{ {
liststore_operations ->clear(); liststore_operations ->clear();