bolero-MURAKAMI / Sprout

C++11/14 constexpr based Containers, Algorithms, Random numbers, Parsing, Ray tracing, Synthesizer, and others.

Home Page:http://bolero-murakami.github.io/Sprout/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

cppljevans opened this issue · 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?