Tuple: mark 2
Chris Jefferson
caj@cs.york.ac.uk
Sat Oct 23 22:14:00 GMT 2004
OK, here is a submission I'm (reasonably) happy with to get started with
of the tuple header.
Files attached:
maketuples.c
tuple, which is generated by running maketuples.c
assignment.cc, big_tuples.cc, comparisons.cc, constructor.cc, get.cc,
make_tuple.cc, tie.cc, tuple_element.cc, tuple_size.cc : a bunch of
tests for the tuple header.
The formatting still isn't perfect, but I think it's at least reasonable.
While there are a pack of positive tests, I haven't got a large set of
negative tests yet (still trying to figure out this xfail business), so
it's possible that there are some things allowed that should be forgiven.
One thing that I'd generally like to change is a nice way of testing the
value of an expression is zero (for example two tuples are the same
size). At the moment I do this with an extra template argument. I used
to make a new template class defined as something like: "template<int i>
struct _IsZero; struct _IsZero<0> {};" , but I'm not convinced this is
perfect as it still lead to an unnessasary symbol being added.
The header tuple is generated by the file maketuple.c. By defining the
symbol "SIZE", you can make different sized tuples. The tests are
defined so that only one test has tuples of size larger than 3, so
testing with smaller tuples only leads to one test failing. I only
promise that maketuple.c works down to tuples of size 2, but I can't
imagine why anyone would want to make smaller tuples!
Things to be done:
1) At the moment the last line is: "swallow_assign ignore;". This
variable actually needs to be defined in the library, not in the header.
At the moment you won't be able to use this header in more than one file
and link it together (although obviously fixing that is easy).
2) The formatting is at least passable, but could be better
3) Was there a final decision that uglification can be removed?
4) I know some changes were made at the recent meeting. Once I get those
I'll make the changes (in particular I've been told the comparison
operators were changed, which is why the tests don't test if the
implementation uses exactly the right operators, as they are changing).
Once I get hold of the updates, I'll implement them!
5) No failing tests yet. There are a bunch that should probably be here.
Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maketuples.c
Type: text/x-csrc
Size: 20009 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tuple
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: assignment.cc
Type: text/x-c++src
Size: 1282 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: big_tuples.cc
Type: text/x-c++src
Size: 2836 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: comparisons.cc
Type: text/x-c++src
Size: 1471 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: constructor.cc
Type: text/x-c++src
Size: 1868 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: get.cc
Type: text/x-c++src
Size: 1342 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make_tuple.cc
Type: text/x-c++src
Size: 1086 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tie.cc
Type: text/x-c++src
Size: 1214 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tuple_element.cc
Type: text/x-c++src
Size: 1247 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tuple_size.cc
Type: text/x-c++src
Size: 1288 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0009.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_tuple
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041023/a14eacd4/attachment-0001.ksh>
More information about the Libstdc++
mailing list