Skip to content

Commit 3ac599f

Browse files
authored
Merge pull request #3097 from ayushjariyal/enable-slicing
clang-tidy: enable cppcoreguidelines-slicing and fix errors
2 parents b27576b + 5c12e51 commit 3ac599f

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Checks: >
2222
-cppcoreguidelines-pro-type-reinterpret-cast,
2323
-cppcoreguidelines-pro-type-union-access,
2424
-cppcoreguidelines-pro-type-vararg,
25-
-cppcoreguidelines-slicing
2625
2726
CheckOptions:
2827
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor

src/pickDeliver/optimize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,12 @@ Optimize::decrease_truck(size_t cycle) {
480480
void
481481
Optimize::save_if_best() {
482482
if (duration() < best_solution.duration()) {
483-
best_solution = (*this);
483+
best_solution = static_cast<const Solution&>(*this);
484484
msg().log << "\n*********** best by duration"
485485
<< best_solution.cost_str();
486486
}
487487
if (fleet.size() < best_solution.fleet.size()) {
488-
best_solution = (*this);
488+
best_solution = static_cast<const Solution&>(*this);
489489
msg().log << "\n*********** best by fleet size"
490490
<< best_solution.cost_str();
491491
}

src/pickDeliver/order.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Order::Order(
5353
std::ostream&
5454
operator<< (std::ostream &log, const Order &order) {
5555
log << "\n\nOrder "
56-
<< static_cast<Identifier>(order) << ": \n"
56+
<< static_cast<const Identifier&>(order) << ": \n"
5757
<< "\tPickup: " << order.pickup() << "\n"
5858
<< "\tDelivery: " << order.delivery() << "\n\n"
5959
<< "\tTravel time: "

0 commit comments

Comments
 (0)