Skip to content

Commit

Permalink
more std::move
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed May 22, 2024
1 parent 132d36e commit a0c7698
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions ortools/util/functions_swig_test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
// simple static methods; because the Java wrapping of the latter made them hard
// to find (whereas the class methods are easy to find).

#include <cstdint>
#include <functional>
#include <string>
#include <utility>

#include "ortools/base/types.h"

namespace operations_research {
class FunctionSwigTestHelpers {
public:
Expand Down Expand Up @@ -79,15 +78,15 @@ class FunctionSwigTestHelpers {

static void NoOpStringToVoid(std::function<void(std::string)> fun,
std::string x) {
fun(x);
fun(std::move(x));
}
};

class DelayedFunctionSwigTestHelpers {
public:
explicit DelayedFunctionSwigTestHelpers(
std::function<int64_t(int64_t, int64_t)> fun)
: fun_(fun) {}
: fun_(std::move(fun)) {}

int64_t NoOpInt64PairToInt64(int64_t x, int64_t y) { return fun_(x, y); }

Expand Down
3 changes: 2 additions & 1 deletion ortools/util/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <iostream>
#include <ostream>
#include <string>
#include <utility>

#include "absl/strings/str_cat.h"

Expand All @@ -27,7 +28,7 @@ SolverLogger::SolverLogger() { timer_.Start(); }

void SolverLogger::AddInfoLoggingCallback(
std::function<void(const std::string& message)> callback) {
info_callbacks_.push_back(callback);
info_callbacks_.push_back(std::move(callback));
}

void SolverLogger::ClearInfoLoggingCallbacks() { info_callbacks_.clear(); }
Expand Down
2 changes: 1 addition & 1 deletion ortools/util/sorted_interval_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ Domain Domain::SquareSuperset() const {
for (const int64_t value : abs_domain.Values()) {
values.push_back(CapProd(value, value));
}
return Domain::FromValues(values);
return Domain::FromValues(std::move(values));
}
}

Expand Down

0 comments on commit a0c7698

Please sign in to comment.