|
Boost : |
From: Herve Bronnimann (hbr_at_[hidden])
Date: 2002-09-10 21:18:11
On Tue, Sep 10, 2002 at 04:35:34PM -0400, Jeffrey C. Jacobs wrote:
> I have written a proposal for the boost community (a small one that will
> help me with other proposals on which I am working) and was wondering even
> if this does not become a part of boost (though I would like you to consider
> it) maybe some of you would be willing to help me answer some of the
> "Unanswered Questions".
You may want to look at a short thread dated May 16-18 2002, between
myself, John Maddock, and Paul Mensonides, where we discussed similar
problem. Thne thread was entitled:
Boost.(type|integer)_traits missing feature?
I had a problem with partial specialization, and Paul suggest some
metaprogramming. I haven't taking a close look at MPL but it might be
just what you need. The problem was related to short being the same type
as int (or char, can't remember) on some platforms, and so a partial
specialization was be defined twice. With an associative list of types,
taking the first match, the problem disappeared.
John Maddock said he would probably add it to type_traits but didn't
know when he'd have the time.
> // Template class sign_traits<Integral> --
> // Supplies:
> // typedef integer_type -- same type as Integral
> // typedef signed_type -- the equivalent of "signed Integral"
> // typedef unsigned_type -- the equivalent of "unsigned Integral"
> // Template function signed_cast<cv-unqualified Integral>
> //
> // Parameters:
> // cv-qualified Integral _T -- type to be converted
> // OR
> // cv-qualified Integral &_T -- reference to type to be converted
> // Returns:
> // cv-qualified signed Integral -- if _T is pass by value
> // OR
> // cv-qualified signed Integral & -- if _T is pass by reference.
> // Template function unsigned_cast<cv-unqualified Integral>
> // Parameters:
> // cv-qualified Integral _T -- type to be converted
> // OR
> // cv-qualified Integral &_T -- reference to type to be converted
> // Returns:
> // cv-qualified unsigned Integral -- if _T is pass by value
> // OR
> // cv-qualified unsigned Integral & -- if _T is pass by reference.
These look good. More thorough than what I have, in that they also
handle the cv-qualification.
-- Herve'
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk