From b679c0596a468033a04eee684d268f4d7027c4ce Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu, 5 Sep 2013 11:46:58 +0200 Subject: [PATCH] Changed one constructor of TemplatePoint. --- MathLib/TemplatePoint.h | 16 +++++----------- MathLib/TemplateWeightedPoint.h | 4 ++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/MathLib/TemplatePoint.h b/MathLib/TemplatePoint.h index ac491149903..52c3782c7b7 100644 --- a/MathLib/TemplatePoint.h +++ b/MathLib/TemplatePoint.h @@ -38,9 +38,9 @@ public: /** constructor - constructs a TemplatePoint object * - * @param list initializer list containing the coordinates of the point + * @param x std::array containing the coordinates of the point */ - TemplatePoint(std::initializer_list<T> const& list); + TemplatePoint(std::array<T,DIM> const& x); /** constructor - constructs a TemplatePoint object \param x values for three coordinates @@ -97,15 +97,9 @@ TemplatePoint<T,DIM>::TemplatePoint() {} template <typename T, std::size_t DIM> -TemplatePoint<T,DIM>::TemplatePoint(std::initializer_list<T> const& list) -{ - assert(list.size() == DIM); - typename std::initializer_list<T>::const_iterator it(list.begin()); - for (std::size_t k(0); k<DIM; k++) { - _x[k] = *it; - it++; - } -} +TemplatePoint<T,DIM>::TemplatePoint(std::array<T,DIM> const& x) : + _x(x) +{} template <typename T, std::size_t DIM> TemplatePoint<T, DIM>::TemplatePoint (T const* x) diff --git a/MathLib/TemplateWeightedPoint.h b/MathLib/TemplateWeightedPoint.h index b2375e8618b..b153bcb72f2 100644 --- a/MathLib/TemplateWeightedPoint.h +++ b/MathLib/TemplateWeightedPoint.h @@ -22,8 +22,8 @@ template <typename FP_T, typename W_T, std::size_t DIM> class TemplateWeightedPoint : public TemplatePoint<FP_T, DIM> { public: - TemplateWeightedPoint(std::initializer_list<FP_T> const& list, W_T weight) : - TemplatePoint<FP_T, DIM>(list), _weight(weight) + TemplateWeightedPoint(std::array<FP_T, DIM> const& x, W_T weight) : + TemplatePoint<FP_T, DIM>(x), _weight(weight) {} W_T getWeight() const -- GitLab