]> git.tdb.fi Git - libs/math.git/blobdiff - source/interpolate/spline.h
Fix a missing return in assignment operator
[libs/math.git] / source / interpolate / spline.h
index 67c8df07d9b9e24904b868ab1950762d7d95c58c..d76197930e5747e7a93e05137309ffeccf2ae5d1 100644 (file)
@@ -2,7 +2,7 @@
 #define MSP_INTERPOLATE_SPLINE_H_
 
 #include <algorithm>
-#include <vector>
+#include "knot.h"
 #include "polynomial.h"
 
 namespace Msp {
@@ -24,6 +24,17 @@ struct SplineValue<T, 1>
        static Type make(const T *v) { return *v; }
 };
 
+template<typename T, unsigned N>
+struct SplineKnot
+{
+       typedef typename SplineValue<T, N>::Type Value;
+       T x;
+       Value y;
+
+       SplineKnot(): x(T()) { }
+       SplineKnot(T x_, const Value &y_): x(x_), y(y_) { }
+};
+
 /**
 Stores a spline of degree D.  It is a piecewise polynomial function with value
 continuity.  Derivatives are not guaranteed to be continuous.
@@ -39,15 +50,7 @@ class Spline
 {
 public:
        typedef typename SplineValue<T, N>::Type Value;
-
-       struct Knot
-       {
-               T x;
-               Value y;
-
-               Knot(): x(T()) { }
-               Knot(T x_, const Value &y_): x(x_), y(y_) { }
-       };
+       typedef SplineKnot<T, N> Knot;
 
        struct Segment
        {
@@ -131,6 +134,8 @@ inline Spline<T, D, N> &Spline<T, D, N>::operator=(const Spline &s)
                capacity = 0;
                segments = 0;
        }
+
+       return *this;
 }
 
 template<typename T, unsigned D, unsigned N>