Boost logo

Boost :

From: Dan McLeran (dan.mcleran_at_[hidden])
Date: 2005-09-15 17:11:11


This could be checked at compile-time. I personally don't want to pursue
this path. I'd rather leave it up to the developer to specify the type of
the result value of this addition.

"Rob Stewart" <stewart_at_[hidden]> wrote in message
news:200509152136.j8FLa52H011209_at_shannonhoon.balstatdev.susq.com...
> From: "Dan McLeran" <dan.mcleran_at_[hidden]>
>>
>> template<typename T1, typename T2>
>> struct AdditionTypeResolver
>> {
>> typedef typename CheckedIntegralValue<T1::min + T2::min, T1::max +
>> T2::max> type;
>> };
>>
>> typedef CheckedIntegralValue<int, -10, 100> Type1;
>> typedef CheckedIntegralValue<int, -100, 20> Type2;
>> Type1 a = -10;
>> Type2 b = -100;
>> AdditionTypeResolver<Type1, Type2 >::type c = a + b;
>
> What if T1::min and T2::min, for example, have different signs?
>
>> "michael toksvig" <michaeltoksvig_at_[hidden]> wrote in message
>> news:dgcini$ble$1_at_sea.gmane.org...
> [big snip]
>
> Please have a look at
> http://www.boost.org/more/discussion_policy.htm#effective,
> particularly the parts on overquoting and quotation style.
>
> --
> Rob Stewart stewart_at_[hidden]
> Software Engineer http://www.sig.com
> Susquehanna International Group, LLP using std::disclaimer;
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk