From bcce353b8ff46ea9d9b83c377f2c835d94096e79 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 10 Oct 2018 00:07:21 +0200 Subject: [PATCH] Check tag >= 0, shortened long lines --- include/fc/static_variant.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/fc/static_variant.hpp b/include/fc/static_variant.hpp index bb21416..3e8d908 100644 --- a/include/fc/static_variant.hpp +++ b/include/fc/static_variant.hpp @@ -359,32 +359,32 @@ public: template static typename visitor::result_type visit( tag_type tag, visitor& v, void* data ) { - static std::vector> wrappers = init_wrappers(); - FC_ASSERT( tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); + static auto wrappers = init_wrappers(); + FC_ASSERT( tag >= 0 && tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); return wrappers[tag]( v, data ); } template static typename visitor::result_type visit( tag_type tag, const visitor& v, void* data ) { - static std::vector> wrappers = init_wrappers(); - FC_ASSERT( tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); + static auto wrappers = init_wrappers(); + FC_ASSERT( tag >= 0 && tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); return wrappers[tag]( v, data ); } template static typename visitor::result_type visit( tag_type tag, visitor& v, const void* data ) { - static std::vector> wrappers = init_const_wrappers(); - FC_ASSERT( tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); + static auto wrappers = init_const_wrappers(); + FC_ASSERT( tag >= 0 && tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); return wrappers[tag]( v, data ); } template static typename visitor::result_type visit( tag_type tag, const visitor& v, const void* data ) { - static std::vector> wrappers = init_const_wrappers(); - FC_ASSERT( tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); + static auto wrappers = init_const_wrappers(); + FC_ASSERT( tag >= 0 && tag < count(), "Unsupported type ${tag}!", ("tag",tag) ); return wrappers[tag]( v, data ); }