Subject: Re: [boost] [xint] Boost.Move vs Copy-on-Write timings
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-05-04 06:07:26
Jeffrey Lee Hellrung, Jr. wrote:
> I see. I feel like a better design would give more abstraction to the
> arithmetic algorithms. E.g., if I want to add 2 integers, the actual
> implementation of addition would take a couple of (pointer, length)
> pairs and a pointer for output (possibly with an optional maximal
> length), it being the callee's responsibility (of course) to ensure the
> output has enough space (up to the maximal length, if given). This
> might seem too C-ish, but it is the common denominator among all your
> integer types (they all boil down to points to an array of digits), and
> it would make your arithmetic algorithms usable for a
> statically-allocated integer type as well (e.g., one built on a
> boost::array< digit_t, n >). Carrying on this discussion might be more
> appropriate in a separate thread, however; one topic at a time.
It might be interesting to make all your types convertible to views
(same as your integers, but only behaving as references to them), and
have your algorithms take views.
That way you wouldn't necessarily need the dynamic allocation.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk