]> git.tdb.fi Git - libs/math.git/commitdiff
Replace typedef with using
authorMikko Rasa <tdb@tdb.fi>
Sun, 26 Jan 2025 00:16:20 +0000 (02:16 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 26 Jan 2025 00:32:23 +0000 (02:32 +0200)
Also remove one type alias which was no longer useful

source/geometry/compositeshape.h
source/interpolate/bezierspline.h
source/interpolate/hermitespline.h
source/interpolate/linearspline.h
source/interpolate/spline.h
source/linal/dynamicmatrix.h
source/linal/dynamicvector.h
source/linal/matrix.h
source/linal/matrixops.h
source/linal/vector.h

index 8814ce00cbc576dbeeab5b4602af254d861ff7ee..aeced4ede8ef46e8da3666d97eb39c19c2afe715 100644 (file)
@@ -17,10 +17,9 @@ template<typename T, unsigned D, typename O>
 class CompositeShape: public Shape<T, D>
 {
 protected:
-       typedef O Ops;
-       typedef std::vector<std::unique_ptr<Shape<T, D>>> ShapeArray;
+       using Ops = O;
 
-       ShapeArray shapes;
+       std::vector<std::unique_ptr<Shape<T, D>>> shapes;
        unsigned max_isect;
 
        CompositeShape() = default;
index c6e295a3dc40072aa9804de0977d280d181bfa19..e6c1a9144fb66ef8d07affeb1ffeccc8acb228f2 100644 (file)
@@ -58,7 +58,7 @@ template<typename T, unsigned D, unsigned N>
 inline BezierSpline<T, D, N>::BezierSpline(const std::vector<Knot> &k):
        Spline<T, D, N>(k.front())
 {
-       typedef SplineValue<T, N> SV;
+       using SV = SplineValue<T, N>;
 
        if((k.size()-1)%D)
                throw std::invalid_argument("BezierSpline::BezierSpline");
index 509aef133997745e71648f9ee753f79d154a66d9..e00a91a3a7e14c41300f0df2cdd2960ad4f6fbbd 100644 (file)
@@ -78,7 +78,7 @@ template<typename T, unsigned N>
 inline HermiteSpline<T, N>::HermiteSpline(const std::vector<Knot> &k):
        Spline<T, 3, N>(k.front())
 {
-       typedef SplineValue<T, N> SV;
+       using SV = SplineValue<T, N>;
 
        this->reserve(k.size()-1);
        for(unsigned i=1; i<k.size(); ++i)
@@ -96,7 +96,7 @@ template<typename T, unsigned N>
 inline HermiteSpline<T, N>::HermiteSpline(Value p0, Value m0, Value p1, Value m1):
        Spline<T, 3, N>(Knot(0, p0, m0))
 {
-       typedef SplineValue<T, N> SV;
+       using SV = SplineValue<T, N>;
 
        this->reserve(1);
        Polynomial<T, 3> p[N];
index 2c88cebbf4d784d774fb35263b5009b021fd1d18..88f250f402470276e26337b13066609c6bb6b37e 100644 (file)
@@ -21,7 +21,7 @@ public:
        LinearSpline(const std::vector<Knot> &k):
                Spline<T, 1, N>(k.front())
        {
-               typedef SplineValue<T, N> SV;
+               using SV = SplineValue<T, N>;
 
                this->reserve(k.size()-1);
                for(unsigned i=1; i<k.size(); ++i)
index 86abd56db2c88fa980c6080e2d4ce422b876531a..0521a8308e52f6010fdd1cce02741d591a8d6974 100644 (file)
@@ -10,7 +10,7 @@ namespace Interpolate {
 template<typename T, unsigned N>
 struct SplineValue
 {
-       typedef LinAl::Vector<T, N> Type;
+       using Type = LinAl::Vector<T, N>;
        static T get(const Type &v, unsigned i) { return v[i]; }
        static Type make(const T *v) { return Type(v); }
 };
@@ -18,7 +18,7 @@ struct SplineValue
 template<typename T>
 struct SplineValue<T, 1>
 {
-       typedef T Type;
+       using Type = T;
        static T get(const Type &v, unsigned) { return v; }
        static Type make(const T *v) { return *v; }
 };
@@ -26,7 +26,7 @@ struct SplineValue<T, 1>
 template<typename T, unsigned N>
 struct SplineKnot
 {
-       typedef typename SplineValue<T, N>::Type Value;
+       using Value = typename SplineValue<T, N>::Type;
        T x;
        Value y;
 
@@ -48,8 +48,8 @@ template<typename T, unsigned D, unsigned N = 1>
 class Spline
 {
 public:
-       typedef typename SplineValue<T, N>::Type Value;
-       typedef SplineKnot<T, N> Knot;
+       using Value = typename SplineValue<T, N>::Type;
+       using Knot = SplineKnot<T, N>;
 
        struct Segment
        {
index 61cf50e301fc2bc1353c35cb7d4abcf1c2d7e654..31ecf9174cdf8dc549d98be32ea85dc77add4fd8 100644 (file)
@@ -18,7 +18,7 @@ template<typename T>
 class DynamicMatrix
 {
 public:
-       typedef T ElementType;
+       using ElementType = T;
 
 private:
        unsigned rows_ = 0;
index a6a59188d1c9b7ffe005a6eed32b4b62c8601545..7de97432cfd4f40024b99468d05ee1a4f7ada311 100644 (file)
@@ -25,7 +25,7 @@ template<typename T>
 class DynamicVector
 {
 public:
-       typedef T ElementType;
+       using ElementType = T;
 
 private:
        unsigned size_ = 0;
index 2ad03447a9b10454f73ab982cf49f26dd25f983f..9f13ae952f7110b2d27c6272dd584971cc038fcb 100644 (file)
@@ -16,7 +16,7 @@ template<typename T, unsigned M, unsigned N>
 class Matrix
 {
 public:
-       typedef T ElementType;
+       using ElementType = T;
 
 private:
        T data[M*N];
index 3b112083c04dae575657c93fe392480d32590081..63bc7495d91ef3fd99346cacf9404d0874d303d6 100644 (file)
@@ -18,7 +18,7 @@ public:
 template<typename T>
 inline T &gauss_jordan(T &m, T &r)
 {
-       typedef typename T::ElementType V;
+       using V = typename T::ElementType;
        using std::abs;
 
        for(unsigned i=0; i<m.columns(); ++i)
index 1587411c63a767192d907f23a7f470f454a676db..b261901ffe7e0deac16b622ae58563e751eb323e 100644 (file)
@@ -75,7 +75,7 @@ template<typename T, unsigned N>
 class Vector: public VectorComponents<T, N>
 {
 public:
-       typedef T ElementType;
+       using ElementType = T;
 
        Vector();
        Vector(const T *);