diff --git a/include/mpark/variant.hpp b/include/mpark/variant.hpp index 697775e70..a0dd0245c 100644 --- a/include/mpark/variant.hpp +++ b/include/mpark/variant.hpp @@ -415,28 +415,21 @@ namespace mpark { constexpr auto fmatrix = make_fmatrix(vs).as_base())...>(); - const std::size_t indices[] = {vs.index()...}; - return at(fmatrix, indices)(std::forward(visitor), - std::forward(vs).as_base()...); + return at(fmatrix, vs.index()...)(std::forward(visitor), + std::forward(vs).as_base()...); } private: template - inline static constexpr const T &at_impl(const T &elem, - const std::size_t *) { + inline static constexpr const T &at(const T &elem) { return elem; } - template - inline static constexpr auto &&at_impl(const std::array &elems, - const std::size_t *index) { - return at_impl(elems[*index], index + 1); - } - - template + template inline static constexpr auto &&at(const std::array &elems, - const std::size_t (&indices)[I]) { - return at_impl(elems, indices); + std::size_t i, + Is... is) { + return at(elems[i], is...); } template