|
Boost : |
Subject: Re: [boost] New Boost.XInt Library, request preliminary review
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-03-31 07:43:32
Scott McMurray wrote:
> On 30 March 2010 17:05, Chad Nelson
> <chad.thecomfychair_at_[hidden]> wrote:
> >
> > Here's how I propose to solve it: make a "core" version of
> > the integer
> > class and functions, with no exception-blocking and no Not-a-Number
> > value, in the namespace xint::core. Then make the main
> > integer class and
> > functions in namespace xint, with exception-blocking, the
> > Not-a-Number value, and maybe infinity values.
>
> I like the idea. Here's a brain dump of a slightly different
> way it could look:
>
> The user would see two classes, finite_xint and nothrow_xint. (Names
> subject to refinement, of course.) They'd share representation
> somehow for move semantics, CoW, or whatever support (which means that
> mixing the two is still efficient, since a temporary of one can turn
> into a temporary of the other cheaply). A finite_xint maintains the
> invariant that it always holds a specific, finite value. A
> nothrow_xint, on the other hand, allows for special values.
[snip lots of goodness]
I like your idea Scott as it provides the right mix of flexibility and functionality to satisfy most (all?) needs. It sounds to me like the policy-based approach we suggested before: a policy-based basic_xint and two typedefs, finite_xint and nothrow_xint, specifying different behavior via policies. (Names still subject to refinement.)
_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk