Topic: signed and unsigned classes


Author: Tringi@mx-3.cz (=?iso-8859-2?B?SmFuIFJpbmdvuQ==?=)
Date: Tue, 20 Feb 2007 18:04:58 GMT
Raw View

Hello everyone,



I recently had to implement some integer classes with specific features =20

(specific width, non-overflowing or signalling carry). I found myself =20

having a little trouble implementing both signed and unsigned versions an=
d =20

reusing most of the code from one in the other version while maintaining =
=20

low code complexity at the same time. I ended up with quite odd template =
=20

that is a little tricky to use by other people.



So I wrote following proposal, available at: =20

http://mx-3.cz/tringi/temp/signed_classes.txt

Do you think it is worth submitting for C++09 or C++1x or is it complete =
=20

nonsense?



PS: This is actually my third try to post this. I was not aware of that =20

the attachments are banned, sorry.



--

Jan Ringo=B9, Tringi@MX-3.cz

http://Tringi.MX-3.cz


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: giecrilj@stegny.2a.pl (=?iso-8859-2?Q?K=F8i=B9tof_=AEelechovski?=)
Date: Thu, 22 Feb 2007 00:22:30 GMT
Raw View
Sorry for top posting, my Outlook Express failed again.

Type modifiers "signed" and "unsigned" belong to C legacy. =20
They cannot be used to modify typename template parameters=20
even if the actual parameter would yield to such a modification.
The correct solution is=20
to provide an explicit specialization for template class integer_variant<=
C>
such that typename integer_variant<C>::signed_type and integer_variant<C>=
::unsigned_type=20
resolve to the appropriate wrapper classes.
I admit it is more verbose - but being verbose is the C++ style anyway.
Such a trait would be most welcome in language utilities. =20
The standard library should provide suitable specializations for all basi=
c integer types.

Chris

U=BFytkownik ""Jan Ringo=B9"" <Tringi@mx-3.cz> napisa=B3 w wiadomo=B6ci n=
ews:op.tnxytkr8gu10gf@merovingian.chello.upc.cz...


Hello everyone,



I recently had to implement some integer classes with specific features =20

(specific width, non-overflowing or signalling carry). I found myself =20

having a little trouble implementing both signed and unsigned versions an=
d =20

reusing most of the code from one in the other version while maintaining =
=20

low code complexity at the same time. I ended up with quite odd template =
=20

that is a little tricky to use by other people.



So I wrote following proposal, available at: =20

http://mx-3.cz/tringi/temp/signed_classes.txt

Do you think it is worth submitting for C++09 or C++1x or is it complete =
=20

nonsense?



PS: This is actually my third try to post this. I was not aware of that =20

the attachments are banned, sorry.



--

Jan Ringo=B9, Tringi@MX-3.cz

http://Tringi.MX-3.cz


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]