Skip to content

Commit 2fb7781

Browse files
authored
Fix dynamic allocation in trajectory.hpp (#214)
lambda to std::function allocates heap memory
1 parent 0c467ad commit 2fb7781

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/ruckig/trajectory.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class Trajectory {
5757
#endif
5858

5959
//! Calculates the base values to then integrate from
60-
using SetIntegrate = std::function<void(size_t, double, double, double, double, double)>;
61-
void state_to_integrate_from(double time, size_t& new_section, const SetIntegrate& set_integrate) const {
60+
template<typename Func>
61+
void state_to_integrate_from(double time, size_t& new_section, Func&& set_integrate) const {
6262
if (time >= duration) {
6363
// Keep constant acceleration
6464
new_section = profiles.size();

0 commit comments

Comments
 (0)