From 7c299378e93cbe1fe9b87ce965f6e70b92965437 Mon Sep 17 00:00:00 2001 From: Liam Mitchell Date: Wed, 20 Oct 2021 16:19:51 -0700 Subject: [PATCH] Avoid specializing templates within an outer class --- include/EASTL/variant.h | 50 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/include/EASTL/variant.h b/include/EASTL/variant.h index e351629a..6e779283 100644 --- a/include/EASTL/variant.h +++ b/include/EASTL/variant.h @@ -1282,36 +1282,36 @@ namespace eastl }; - - // abstracts calling visit on a single variant with return types convertible to R - struct visitor_caller_one_r + template + struct visitor_r { - template - struct visitor_r + template + static EA_CONSTEXPR R invoke_visitor_r(Visitor&& visitor, Variant&& variant) { - template - static EA_CONSTEXPR R invoke_visitor_r(Visitor&& visitor, Variant&& variant) - { - return eastl::invoke(eastl::forward(visitor), - eastl::get(eastl::forward(variant))); - } - }; + return eastl::invoke(eastl::forward(visitor), + eastl::get(eastl::forward(variant))); + } + }; - // void return type must discard the return values of the visitor even if the visitor returns a value. - template <> - struct visitor_r + // void return type must discard the return values of the visitor even if the visitor returns a value. + template <> + struct visitor_r + { + template + static EA_CONSTEXPR void invoke_visitor_r(Visitor&& visitor, Variant&& variant) { - template - static EA_CONSTEXPR void invoke_visitor_r(Visitor&& visitor, Variant&& variant) - { - eastl::invoke(eastl::forward(visitor), - eastl::get(eastl::forward(variant))); - } - }; - template<> struct visitor_r : public visitor_r {}; - template<> struct visitor_r : public visitor_r {}; - template<> struct visitor_r : public visitor_r {}; + eastl::invoke(eastl::forward(visitor), + eastl::get(eastl::forward(variant))); + } + }; + + template<> struct visitor_r : public visitor_r {}; + template<> struct visitor_r : public visitor_r {}; + template<> struct visitor_r : public visitor_r {}; + // abstracts calling visit on a single variant with return types convertible to R + struct visitor_caller_one_r + { template static EA_CPP14_CONSTEXPR decltype(auto) call_index_r(Visitor&& visitor, Variant&& variant, eastl::index_sequence) {