|
Formula Student Autonomous Systems
The code for the main driverless system
|
In this file, a function is implemented to fit a spline to a set of ordered points. More...
#include <splines.hpp>


In this file, a function is implemented to fit a spline to a set of ordered points.
The function, called 'fit_spline' is a template function, and to guarantee that it is only called with suitable types, a series of static_asserts are used to check if the template type T has the necessary methods defined. The structs below are used in the context of a method for static assertion in C++17 called SFINAE ("Substitution Failure Is Not An Error").
For each method that must be implemented, there are two structs with the same name: one that inherits from false_type and another that inherits from true_type. When trying to instatiate a struct, the compiler will choose the one that makes sense (if the method is implemented, the one that inherits from true_type will be chosen; otherwise the one which inherits form false_type will be used).
After that, the compiler can assert at compile time if the type T implements each of the methods that are necessary for the function to work properly with static_asserts (inside the "fit_spline" function).
Definition at line 39 of file splines.hpp.