Skip to content

Commit 07d8acb

Browse files
committed
accept const-refs in liftModifiedSolution
clang-tidy rightfully complained that moving rvalues doesn't make sense when the underlying method accepts const refs. The rvalue parameter interface, as it is used with spawn/etc. indicates that the solution is submitted to the system. But with the shared_ptr interface we need for `liftModifiedSolution` it does not make any sense, especially because we can't even move the passed pointer to the internal datastructures but have to copy...
1 parent a5a35fb commit 07d8acb

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

core/include/moveit/task_constructor/container.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ class ParallelContainerBase : public ContainerBase
127127
void liftSolution(const SolutionBase& solution, double cost, std::string comment);
128128

129129
/// lift a modified solution based on the solution of a child stage
130-
void liftModifiedSolution(SolutionBasePtr&& new_solution, const SolutionBase& child_solution);
130+
void liftModifiedSolution(const SolutionBasePtr& new_solution, const SolutionBase& child_solution);
131131
/// lift a modified solution, changing the (single!) new associated start or end InterfaceState
132-
void liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state,
132+
void liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_propagated_state,
133133
const SolutionBase& child_solution);
134134
/// lift a modified solution, providing new start and end states
135135
/// The new states will only be used if this's should actually create the corresponding states
136-
void liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_start_state,
136+
void liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_start_state,
137137
InterfaceState&& new_end_state, const SolutionBase& child_solution);
138138
};
139139

core/src/container.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -771,35 +771,34 @@ void ParallelContainerBase::liftSolution(const SolutionBase& solution, double co
771771
solution.start(), solution.end());
772772
}
773773

774-
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& modified_solution, const SolutionBase& child_solution) {
774+
void ParallelContainerBase::liftModifiedSolution(const SolutionBasePtr& modified_solution, const SolutionBase& child_solution) {
775775
// child_solution is correctly prepared by a child of this container
776776
assert(child_solution.creator());
777777
assert(child_solution.creator()->parent() == this);
778778

779-
pimpl()->liftSolution(std::move(modified_solution),
780-
child_solution.start(), child_solution.end());
779+
pimpl()->liftSolution(modified_solution, child_solution.start(), child_solution.end());
781780
}
782781

783-
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
782+
void ParallelContainerBase::liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_propagated_state, const SolutionBase& child_solution) {
784783
assert(child_solution.creator());
785784
assert(child_solution.creator()->parent() == this);
786785

787786
if(pimpl()->requiredInterface() == GENERATE){
788787
// in this case we need a second InterfaceState to move from
789788
InterfaceState new_to{ new_propagated_state };
790-
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_to);
789+
pimpl()->liftSolution(new_solution, child_solution.start(), child_solution.end(), &new_propagated_state, &new_to);
791790
}
792791
else {
793792
// pass new_propagated_state as start *and* end. We know at most one will be used.
794-
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_propagated_state, &new_propagated_state);
793+
pimpl()->liftSolution(new_solution, child_solution.start(), child_solution.end(), &new_propagated_state, &new_propagated_state);
795794
}
796795
}
797796

798-
void ParallelContainerBase::liftModifiedSolution(SolutionBasePtr&& new_solution, InterfaceState&& new_from, InterfaceState&& new_to, const SolutionBase& child_solution) {
797+
void ParallelContainerBase::liftModifiedSolution(const SolutionBasePtr& new_solution, InterfaceState&& new_from, InterfaceState&& new_to, const SolutionBase& child_solution) {
799798
assert(child_solution.creator());
800799
assert(child_solution.creator()->parent() == this);
801800

802-
pimpl()->liftSolution(std::move(new_solution), child_solution.start(), child_solution.end(), &new_from, &new_to);
801+
pimpl()->liftSolution(new_solution, child_solution.start(), child_solution.end(), &new_from, &new_to);
803802
}
804803

805804

0 commit comments

Comments
 (0)