Boost logo

Boost :

Subject: Re: [boost] [xint] Design Improvements (was Boost.Move vs Copy-on-Write timings)
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-05-04 14:28:07


On 5/4/2010 11:01 AM, Mathias Gaunard wrote:
> Le 04/05/2010 16:39, Chad Nelson a écrit :
>> On 05/04/2010 06:07 AM, Mathias Gaunard wrote:
>>
>>> 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.
>>
>> I'm not sure I understand what you're suggesting. If views are the same
>> as my integers, then they're essentially the same as base_integer as
>> well, so that's what I'm already doing. Or am I missing something?
>
> They do not own anything, they're simply thin wrappers on top of the
> pointer, and you can construct them from the pointer and whatever
> information you need as well.
>
> That way the user does not need to allocate his memory with dynamic
> memory allocation -- or even with your type -- to run your arbitrary
> precision algorithms.

+1, and going the natural step further, build these algorithms off a
view *concept*, rather then hard-coding a specific view class, for
maximum flexibility. The requirements you need *might* be as simple as
existing range requirements in many cases (see Boost.Range).

- Jeff


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