Sprout icon indicating copy to clipboard operation
Sprout copied to clipboard

sizeof(variant<T...>) > sizeof(tuple<T...>)?

Open cppljevans opened this issue 9 years ago • 0 comments

https://github.com/bolero-MURAKAMI/Sprout/blob/master/sprout/variant/variant.hpp

shows, on lines 81 and then on lines 52 and 40 that the size of the variant<T...> is sizeof(int)+sizeof(tuple<T...>. That seems a waste of space to me since other variants, such as this one:

https://github.com/ericniebler/range-v3/blob/master/include/range/v3/utility/variant.hpp

and the existing boost one:

http://www.boost.org/doc/libs/1_58_0/doc/html/variant.html

make the size close to max of the sizeof(T)...

Why wasn't a similar space saving designed used for sprout's variant?

cppljevans avatar Jun 06 '15 09:06 cppljevans