Skip to content
Snippets Groups Projects
Commit b679c059 authored by Tom Fischer's avatar Tom Fischer
Browse files

Changed one constructor of TemplatePoint.

parent a8f93e3f
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,9 @@ public: ...@@ -38,9 +38,9 @@ public:
/** constructor - constructs a TemplatePoint object /** 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 /** constructor - constructs a TemplatePoint object
\param x values for three coordinates \param x values for three coordinates
...@@ -97,15 +97,9 @@ TemplatePoint<T,DIM>::TemplatePoint() ...@@ -97,15 +97,9 @@ TemplatePoint<T,DIM>::TemplatePoint()
{} {}
template <typename T, std::size_t DIM> template <typename T, std::size_t DIM>
TemplatePoint<T,DIM>::TemplatePoint(std::initializer_list<T> const& list) TemplatePoint<T,DIM>::TemplatePoint(std::array<T,DIM> const& x) :
{ _x(x)
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++;
}
}
template <typename T, std::size_t DIM> template <typename T, std::size_t DIM>
TemplatePoint<T, DIM>::TemplatePoint (T const* x) TemplatePoint<T, DIM>::TemplatePoint (T const* x)
......
...@@ -22,8 +22,8 @@ template <typename FP_T, typename W_T, std::size_t DIM> ...@@ -22,8 +22,8 @@ template <typename FP_T, typename W_T, std::size_t DIM>
class TemplateWeightedPoint : public TemplatePoint<FP_T, DIM> class TemplateWeightedPoint : public TemplatePoint<FP_T, DIM>
{ {
public: public:
TemplateWeightedPoint(std::initializer_list<FP_T> const& list, W_T weight) : TemplateWeightedPoint(std::array<FP_T, DIM> const& x, W_T weight) :
TemplatePoint<FP_T, DIM>(list), _weight(weight) TemplatePoint<FP_T, DIM>(x), _weight(weight)
{} {}
W_T getWeight() const W_T getWeight() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment