Boost logo

Boost :

Subject: Re: [boost] [design] policy based. Was: [XInt] Review
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2011-03-14 10:20:59


On Sat, 12 Mar 2011 22:36:58 +0100
Joachim Faulhaber <afojgo_at_[hidden]> wrote:

> With respect to the side note of Jan, I'd like to resume the example
> of a policy based design. As we are separating concerns and
> encapsulate them into policy classes, we should be able to code a
> behavior like the MS SafeInt mentioned by Jan in a policy class.
>
> typedef aint<int, MsSafeIntBehavior> aSafeInt;
> typedef aint<xint::integer_t<options::fixedlenth<512> >,
> MsSafeIntBehavior> anXSafeInt;
[...]

I haven't studied the original article yet, but if I'm reading that
right, MsSafeIntBehavior is just wrapping the type specified by the
initial parameter. That would neatly solve at least one of the problems
I was pondering. I'll examine these carefully when I have a chance to
do so.

> Another aspect I wanted to develop further is
>
> (4) Reduction of code replication.
>
> In the first example of 'class aint' we have still code replication
> [...]

Ahh... I'd come up with something similar, if cruder, while thinking
about your initial message. Nice to see I was on the right track.

> I hope this is not too, well, overwhelming and still helpful ;-/

I think it will be, once I sit down and work with it a while. Thank you.

-- 
Chad Nelson
Oak Circle Software, Inc.
*
*
*



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