From 079a7be67d15c7f1a770f5e289d31b676e771bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 3 Aug 2012 18:12:55 +0200 Subject: [PATCH] Disable non-constexpr one-parameter constructor for Vector<1, T>. It was clashing with the default "initializer-list" constructor, which is constexpr. This constructor is also explicit, which makes it impossible to e.g. return Vector<1, T> from function without explicitly specifying name , while for Vector<2, T> it works: return {1, 2}; // works for Vector<2, int> return {1}; // doesn't work for Vector<1, int> --- src/Math/Vector.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Math/Vector.h b/src/Math/Vector.h index d84f312ab..0a56fa479 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -103,7 +103,11 @@ template class Vector { * @brief Constructor * @param value Value for all fields */ + #ifndef DOXYGEN_GENERATING_OUTPUT + template inline explicit Vector(typename std::enable_if::value && size != 1, U>::type value) { + #else inline explicit Vector(T value) { + #endif for(size_t i = 0; i != size; ++i) _data[i] = value; }