This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simplifing tuples


>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.

To be clear: I'm up for anything. I was just expressing a preference for
compile time hacking. It's my opinion that build-time complexity quickly
gets out of hand with libstdc++, because of the vastness of the
supported build configurations: native on all supported hosts, crosses,
canadians, etc.

We used to compute <limits> at build time, and it only worked (well) for
native targets. I don't see why this should be a limitation for tuple.

>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.

Did you have something specific in mind? Perhaps it would be best if we
both wait for Chris to post something....

>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.

You might ask Chris about this. I think this might be useful, actually.
However, here we go again, with dependent expressions.....  Do you have
an implementation in mind? If you come up with one perhaps we could
experiment with it, and see. This would probably be useful, actually:

template<typename T, int N>
void error()
{
  __builtin_static_assert(sizeof(T)>N, "type %qT too small", T);
}

int main()
{
  error<int, 2>();
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]