diff --git a/MathLib/TemplatePoint.h b/MathLib/TemplatePoint.h index ac4911499039fe620b391cad69996cf0a4adf9b5..52c3782c7b7663fcc00f14b120d64e86570aaee1 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 b2375e8618b51787e4faabfaec229dffed3c490d..b153bcb72f2ff254e80489acc9c09fa81637dc0b 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