diff --git a/src/OpenMesh/Core/Geometry/Vector11T.hh b/src/OpenMesh/Core/Geometry/Vector11T.hh index fe0b92b2..b8382bd6 100644 --- a/src/OpenMesh/Core/Geometry/Vector11T.hh +++ b/src/OpenMesh/Core/Geometry/Vector11T.hh @@ -158,8 +158,11 @@ class VectorT { } /// construct from a value array or any other iterator - template - explicit inline VectorT(Iterator it) { + template(), void(), + ++std::declval(), void())> + explicit VectorT(Iterator it) { std::copy_n(it, DIM, values_.begin()); } @@ -167,7 +170,7 @@ class VectorT { template::value>> - explicit inline VectorT(const VectorT& _rhs) { + explicit VectorT(const VectorT& _rhs) { operator=(_rhs); } @@ -376,7 +379,7 @@ class VectorT { /// \see OpenMesh::dot template auto operator|(const VectorT& _rhs) const -> - decltype(*data() * *_rhs.data()) { + decltype(*this->data() * *_rhs.data()) { return std::inner_product(data() + 1, data() + DIM, _rhs.data() + 1, *data() * *_rhs.data()); diff --git a/src/Unittests/unittests_vector_type.cc b/src/Unittests/unittests_vector_type.cc index bb27754d..8d6cced1 100644 --- a/src/Unittests/unittests_vector_type.cc +++ b/src/Unittests/unittests_vector_type.cc @@ -214,6 +214,9 @@ TEST_F(OpenMeshVectorTest, array_init) { float a[3]; a[0] = 1.0; a[1] = 2.0; a[2] = 3.0; OpenMesh::Vec3f v(a); EXPECT_EQ(OpenMesh::Vec3f(1.0, 2.0, 3.0), v); + + // This should not invoke the array constructor. + OpenMesh::Vec3d v2(3.0f); } TEST_F(OpenMeshVectorTest, normalized_cond) {