In static_variant use int64_t as a tag type

This commit is contained in:
Anton Autushka 2018-02-06 13:00:51 +03:00
parent 1ae7f6bb02
commit bf86466be1

View file

@ -181,7 +181,8 @@ class static_variant {
static_assert(impl::type_info<Types...>::no_reference_types, "Reference types are not permitted in static_variant.");
static_assert(impl::type_info<Types...>::no_duplicates, "static_variant type arguments contain duplicate types.");
size_t _tag;
using tag_type = int64_t;
tag_type _tag;
char storage[impl::type_info<Types...>::size];
template<typename X>
@ -326,14 +327,14 @@ public:
}
static int count() { return impl::type_info<Types...>::count; }
void set_which( size_t w ) {
void set_which( tag_type w ) {
FC_ASSERT( w < count() );
this->~static_variant();
_tag = w;
impl::storage_ops<0, Types...>::con(_tag, storage);
}
size_t which() const {return _tag;}
tag_type which() const {return _tag;}
};
template<typename Result>