Boost logo

Boost :

Subject: Re: [boost] [Review] XInt Review
From: Marsh Ray (marsh_at_[hidden])
Date: 2011-03-04 10:20:33


On 03/04/2011 03:49 AM, Joel Falcou wrote:
>
> The premises are OK. We have some large integer type that has proper
> value semantic and can be used in a variety of operations and functions.
> So far, so good. The main culprit is that the current library design is
> rather hardwired to work with a choice of implementation the author
> thought to be OK at some point but which still have to be proven better
> than existing solution.
>
> The overall design lacks separation between the data and the algorithm
> that makes the library difficult to extend

To the extent that Boost is a proving ground for things suitable for
possible inclusion in a future C++ standard, it seems to me that a
review of something like XInt (in particular due to its general utility)
ought to focus on the quality of the interface rather than a specific
implementation.

If the interface really does prescribe the implementation with a great
deal of specificity, then in my view it should not be adopted as a library.

>: what if i want to take an
> arbitrary range of integers and look at them as a huge series of bits ?
> What if i don't want the extra memory overhead so i can mmap some files
> directly into memory (cause reading a 10k bits integer is a no-no) ?
> Can I pass the integer type to a STD algorithm if I want to iterate over
> the bytes it contains ? or copy them using boost::range copy ?

Or stream the bits lazily, generating them as they are needed?

> - use expression template to handle efficient combination of operations
> and potentially detect optimisable pattern. Proto is a shoe-in for this.

Is that not prescribing an implementation?

A bigint facility that strained the limits of my compiler and pushed
compile times through the roof is not useful to me.

> - the algorithm should be more generic and not be tied to the concrete
> type of large integer used.

What about just working out a bigint concept with a straightforward
implementation that permitted, but did not require, expression templates?

XInt could be adapted to serve as a reference implementation and a
frontend with selectable back-ends.

- Marsh


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