|
Boost : |
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2006-04-05 02:37:56
Andy Little <andy <at> servocomm.freeserve.co.uk> writes:
> I wonder if the three functions are necessary together?
>
> Either there should only be promote or there should only be
integral_promotion, float_promotion.
I was never sure about floating_point_promotion<> and promote<>.
Section 13.3.3.1.1 of the standard conviced me to add them.
It defines Promotion category of standard conversion sequences.
> The main rationale for integral_promotion is for enums. float
> promotion and promotion usage are already handled by Boost.Typeof.
I would say, floating_point_promotion<> is easily implementable
even without Boost.Typeof.
> ints and floats are very different entities and I wonder if its
> approporiate to apply the same behaviours.
I agree.
> I dont really like the fact types unrelated to int or floats can silently
> pass through as a general rule, but I think I see the reasoning given
> the use cases. It could be documented though.
It's documented by not emphasized:
type: T if integral promotion can't be applied to an rvalue of type T;
otherwise, a type of integral promotion of an rvalue of type T.
Resulting type is same cv-qualified as T.
> I think it needs some more rationale and examples. I understand its
> meant to fit with type_traits, but the documentation for other
> type_traits does include examples and there is room for a bit of
> rationale too.
Only few type_traits classes are explained in tutorial.
I can't add mine without asking the authors.
>
> I vote yes to accept it.
Thanks.
-- Alexander Nasonov
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk