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


On Mon, Oct 18, 2004 at 02:11:44PM +0200, Giovanni Bajo wrote:
> Well, if you look at the Boost implementation, they convert the types of the
> elements into a typelist, which is then used recursively. Also the data
> representation is recursive:
[...]
> if there is an error accessing an element at index #4, it will have an
> instatition stack printed which two times bigger than an item at index #2.
[...]
> Yeah, I can see *many* uses. For instance, thinking of tuples, if you implement
> the get<> accessor you will need a template function to return the type of the
> Nth element:

This technique is more or less straight from the Alexandrescu text.
The pros and cons should be well known by now.


> Another thing that came to my mind is that __builtin_static_assert would have
> another argument which is the exact number of instantiation contexts to hide
> while priting the error. For instance, with the static_assert above you get
> this:

Oh, yuck.  Part of the point of C++'s implicit instantiation of needed
templates is that it all happens automatically, to whatever depth is
needed.  Users of __builtin_static_assert should not be required to count
instantiation levels.

-- 
Behind everything some further thing is found, forever; thus the tree behind
the bird, stone beneath soil, the sun behind Urth.  Behind our efforts, let
there be found our efforts.
              - Ascian saying, as related by Loyal to the Group of Seventeen


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