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


Benjamin Kosnik <bkoz@redhat.com> writes:

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

100% agreed.

[...]

| 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>();

That requires execution.

I think the static_assert is better than nothing, but is way too low
level to help structures in useful ways. It does not help considering
alternatives and a construct is invalid.

-- Gaby


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