File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -210,9 +210,11 @@ template <typename _Scalar> struct TrajOptProblemTpl {
210210 std::size_t num_threads = 1 ,
211211 bool compute_second_order = true ) const ;
212212
213- // / @brief Pop out the first StageModel and replace by the supplied one;
214- // / updates the supplied problem data (TrajOptDataTpl) object.
215- void replaceStageCircular (const xyz::polymorphic<StageModel> &model);
213+ // / @brief Advance each stage model by one slot after inserting a new stage,
214+ // / pop out the first model.
215+ // / @returns The first StageModel.
216+ xyz::polymorphic<StageModel>
217+ replaceStageCircular (const xyz::polymorphic<StageModel> &model);
216218
217219 bool checkIntegrity () const ;
218220
Original file line number Diff line number Diff line change @@ -164,11 +164,13 @@ inline std::size_t TrajOptProblemTpl<Scalar>::numSteps() const {
164164}
165165
166166template <typename Scalar>
167- void TrajOptProblemTpl<Scalar>::replaceStageCircular(
168- const xyz::polymorphic<StageModel> &model) {
167+ auto TrajOptProblemTpl<Scalar>::replaceStageCircular(
168+ const xyz::polymorphic<StageModel> &model) -> xyz::polymorphic<StageModel> {
169169 addStage (model);
170170 rotate_vec_left (stages_);
171+ auto last = std::move (stages_.back ());
171172 stages_.pop_back ();
173+ return last;
172174}
173175
174176template <typename Scalar>
You can’t perform that action at this time.
0 commit comments