This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Simplifing tuples
[sorry, sent to gcc@ by mistake]
Benjamin Kosnik wrote:
> I'm more in favor of compile-time construction via metaprogramming
> (only as complicated as is absolutely necessary, of course...). In
> the long run, this seems like the more robust solution. Also, one
> without build dependencies. It seems like either way you'll have some
> complexity, it's just where you choose to put it.
I'm not sure. We could commit the generated <tuple> to CVS much like we do with
configure for instance, so that there is no build dependence at all. The only
cons I see with the generation program is that hacking could get much harder,
depending on how the generation program is written.
I think there is no perfect solution for this. If it were up to me, I would try
to generate everything with preprocessor magic, but without making it recursive
ala Boost. There is probably a way to flat the template hierarchy so that you
do not get hundreds of lines of instantiation context.
Working on an extension to drive the error machinery from the compiler is also
preferrable. I think the best would be to come up with a way to write a static
assert such as:
STATIC_ASSERT(sizeof(T) > N, "type %qT too small", T);
which would emit something like:
blah.h:2345: error: type 'int' too small
I wonder if __builtin_static_assert(sizeof(T)>N, "type %qT too small", T) would
do the trick.
Giovanni Bajo