From ef0e389181c0af4fdb70b6c2fa2bf181e3ba8059 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 31 Oct 2018 00:12:13 +0000 Subject: [PATCH] Core: Workaround for MSC issue in Tuple git-svn-id: svn://ultimatepp.org/upp/trunk@12431 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Tuple.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/uppsrc/Core/Tuple.h b/uppsrc/Core/Tuple.h index 6c5530b2a..ad4c2b04d 100644 --- a/uppsrc/Core/Tuple.h +++ b/uppsrc/Core/Tuple.h @@ -97,27 +97,15 @@ struct TupleN<4, A, B, C, D> : public TupleN<3, A, B, C> #define GET_FROM_TUPLE(M, I) \ \ template \ -auto GetFromTuple(const T& t, const IndexI__&) -> const decltype(t.M)& \ +auto GetFromTuple(const T& t, const IndexI__&) -> decltype(t.M)& \ { \ - return t.M; \ + return const_cast(t).M; \ } \ \ template \ -auto GetFromTupleByType(const T& t, decltype(t.M)*, const IndexI__* = NULL) -> const decltype(t.M)& \ +auto GetFromTupleByType(const T& t, decltype(t.M)*, const IndexI__* = NULL) -> decltype(t.M)& \ { \ - return t.M; \ -} \ - \ -template \ -auto GetFromTuple(T& t, const IndexI__&) -> decltype(t.M)& \ -{ \ - return t.M; \ -} \ - \ -template \ -auto GetFromTupleByType(T& t, decltype(t.M)*, const IndexI__* = NULL) -> decltype(t.M)& \ -{ \ - return t.M; \ + return const_cast(t).M; \ } GET_FROM_TUPLE(a, 0)