Reduce the size of variant, it doesn't need an index of type size_t internally.
authorVille Voutilainen <ville.voutilainen@gmail.com>
Wed, 11 Jan 2017 11:23:43 +0000 (13:23 +0200)
committerVille Voutilainen <ville@gcc.gnu.org>
Wed, 11 Jan 2017 11:23:43 +0000 (13:23 +0200)
commitf3df0b3cde2476f77059e4c3a704ab1960fa883a
tree8e92072dbc8ee05ff40976301839998c89081a90
parent51020892466d37f71ee13137bdadcbb32545c55d
Reduce the size of variant, it doesn't need an index of type size_t internally.

Reduce the size of variant, it doesn't need an index of
type size_t internally.
* include/std/variant (parse_numbers.h): New include.
(__select_index): New.
(_Variant_storage<false, _Types...>::_M_reset_impl): Use
_index_type for comparison with variant_npos.
(_Variant_storage<false, _Types...>::__index_type): New.
(_Variant_storage<false, _Types...>::_M_index): Change the
type from size_t to __index_type.
(_Variant_storage<true, _Types...>::__index_type): New.
(_Variant_storage<true, _Types...>::_M_index): Change the
type from size_t to __index_type.
(_Variant_base::_M_valid): Use _Storage::__index_type
for comparison with variant_npos.
(variant::index): Use _Base::_Storage::__index_type
for comparison with variant_npos.
* testsuite/20_util/variant/index_type.cc: New.

From-SVN: r244309
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/variant
libstdc++-v3/testsuite/20_util/variant/index_type.cc [new file with mode: 0644]