From 73ca103e1af1a6f2e38c295416a0f1690f5adb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 24 Aug 2016 17:38:58 +0200 Subject: [PATCH] Math: proper implementation for NoInit and ZeroInit Bezier constructor. --- src/Magnum/Math/Bezier.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Math/Bezier.h b/src/Magnum/Math/Bezier.h index 242169886..cbefc87e9 100644 --- a/src/Magnum/Math/Bezier.h +++ b/src/Magnum/Math/Bezier.h @@ -63,10 +63,22 @@ template class Bezier { * * Construct the curve with all control points being zero vectors. */ - constexpr /*implicit*/ Bezier(ZeroInitT = ZeroInit) noexcept: _data{} {} + constexpr /*implicit*/ Bezier(ZeroInitT = ZeroInit) noexcept + /** @todoc remove workaround when doxygen is sane */ + #ifndef DOXYGEN_GENERATING_OUTPUT + /* MSVC 2015 can't handle {} here */ + : Bezier(typename Implementation::GenerateSequence::Type{}, ZeroInit) + #endif + {} /** @brief Construct Bézier without initializing the contents */ - explicit Bezier(NoInitT) noexcept {} + explicit Bezier(NoInitT) noexcept + /** @todoc remove workaround when doxygen is sane */ + #ifndef DOXYGEN_GENERATING_OUTPUT + /* MSVC 2015 can't handle {} here */ + : Bezier(typename Implementation::GenerateSequence::Type{}, NoInit) + #endif + {} /** @brief Construct Bézier curve with given array of control points */ template constexpr Bezier(const Vector& first, U... next) noexcept: _data{first, next...} { @@ -125,6 +137,10 @@ template class Bezier { } private: + /* Implementation for Bezier::Bezier(ZeroInitT) and Bezier::Bezier(NoInitT) */ + /* MSVC 2015 can't handle {} here */ + template constexpr explicit Bezier(Implementation::Sequence, U): _data{Vector((static_cast(sequence), U{typename U::Init{}}))...} {} + /* Calculates and returns all intermediate points generated when using De Casteljau's algorithm */ std::array, order + 1> calculateIntermediatePoints(Float t) const { std::array, order + 1> iPoints;