From c4e4fc8370a0674587c5772e7adffe6a486cb602 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 26 Jan 2025 02:16:20 +0200 Subject: [PATCH] Replace typedef with using Also remove one type alias which was no longer useful --- source/geometry/compositeshape.h | 5 ++--- source/interpolate/bezierspline.h | 2 +- source/interpolate/hermitespline.h | 4 ++-- source/interpolate/linearspline.h | 2 +- source/interpolate/spline.h | 10 +++++----- source/linal/dynamicmatrix.h | 2 +- source/linal/dynamicvector.h | 2 +- source/linal/matrix.h | 2 +- source/linal/matrixops.h | 2 +- source/linal/vector.h | 2 +- 10 files changed, 16 insertions(+), 17 deletions(-) diff --git a/source/geometry/compositeshape.h b/source/geometry/compositeshape.h index 8814ce0..aeced4e 100644 --- a/source/geometry/compositeshape.h +++ b/source/geometry/compositeshape.h @@ -17,10 +17,9 @@ template class CompositeShape: public Shape { protected: - typedef O Ops; - typedef std::vector>> ShapeArray; + using Ops = O; - ShapeArray shapes; + std::vector>> shapes; unsigned max_isect; CompositeShape() = default; diff --git a/source/interpolate/bezierspline.h b/source/interpolate/bezierspline.h index c6e295a..e6c1a91 100644 --- a/source/interpolate/bezierspline.h +++ b/source/interpolate/bezierspline.h @@ -58,7 +58,7 @@ template inline BezierSpline::BezierSpline(const std::vector &k): Spline(k.front()) { - typedef SplineValue SV; + using SV = SplineValue; if((k.size()-1)%D) throw std::invalid_argument("BezierSpline::BezierSpline"); diff --git a/source/interpolate/hermitespline.h b/source/interpolate/hermitespline.h index 509aef1..e00a91a 100644 --- a/source/interpolate/hermitespline.h +++ b/source/interpolate/hermitespline.h @@ -78,7 +78,7 @@ template inline HermiteSpline::HermiteSpline(const std::vector &k): Spline(k.front()) { - typedef SplineValue SV; + using SV = SplineValue; this->reserve(k.size()-1); for(unsigned i=1; i inline HermiteSpline::HermiteSpline(Value p0, Value m0, Value p1, Value m1): Spline(Knot(0, p0, m0)) { - typedef SplineValue SV; + using SV = SplineValue; this->reserve(1); Polynomial p[N]; diff --git a/source/interpolate/linearspline.h b/source/interpolate/linearspline.h index 2c88ceb..88f250f 100644 --- a/source/interpolate/linearspline.h +++ b/source/interpolate/linearspline.h @@ -21,7 +21,7 @@ public: LinearSpline(const std::vector &k): Spline(k.front()) { - typedef SplineValue SV; + using SV = SplineValue; this->reserve(k.size()-1); for(unsigned i=1; i struct SplineValue { - typedef LinAl::Vector Type; + using Type = LinAl::Vector; 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 struct SplineValue { - 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 template struct SplineKnot { - typedef typename SplineValue::Type Value; + using Value = typename SplineValue::Type; T x; Value y; @@ -48,8 +48,8 @@ template class Spline { public: - typedef typename SplineValue::Type Value; - typedef SplineKnot Knot; + using Value = typename SplineValue::Type; + using Knot = SplineKnot; struct Segment { diff --git a/source/linal/dynamicmatrix.h b/source/linal/dynamicmatrix.h index 61cf50e..31ecf91 100644 --- a/source/linal/dynamicmatrix.h +++ b/source/linal/dynamicmatrix.h @@ -18,7 +18,7 @@ template class DynamicMatrix { public: - typedef T ElementType; + using ElementType = T; private: unsigned rows_ = 0; diff --git a/source/linal/dynamicvector.h b/source/linal/dynamicvector.h index a6a5918..7de9743 100644 --- a/source/linal/dynamicvector.h +++ b/source/linal/dynamicvector.h @@ -25,7 +25,7 @@ template class DynamicVector { public: - typedef T ElementType; + using ElementType = T; private: unsigned size_ = 0; diff --git a/source/linal/matrix.h b/source/linal/matrix.h index 2ad0344..9f13ae9 100644 --- a/source/linal/matrix.h +++ b/source/linal/matrix.h @@ -16,7 +16,7 @@ template class Matrix { public: - typedef T ElementType; + using ElementType = T; private: T data[M*N]; diff --git a/source/linal/matrixops.h b/source/linal/matrixops.h index 3b11208..63bc749 100644 --- a/source/linal/matrixops.h +++ b/source/linal/matrixops.h @@ -18,7 +18,7 @@ public: template 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 class Vector: public VectorComponents { public: - typedef T ElementType; + using ElementType = T; Vector(); Vector(const T *); -- 2.45.2