|
Boost : |
Subject: Re: [boost] [xint] Boost.XInt formal review
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-03-02 12:18:33
On 02/03/2011 11:58, Vladimir Prus wrote:
> Boosters,
>
> the formal review of the Boost.XInt library, by Chad Nelson, starts now and will
> run through March 11.
>
> The documentation for the current version is available at:
>
> http://www.oakcircle.com/xint_docs/
This is not a review, just a few comments from going through the docs
quickly.
- XInt uses COW and passes everything by value. COW is useless in the
presence of move semantics (which the library seems to partially
implement), and passing by value everywhere unless you mean to copy is a
bad idea.
Taking by value can be useful to implement operator+ in terms of
operator+=, but the library doesn't seem to do that.
Also, it seems that the object always contains the copy count and a
readonly boolean, which total 2 words, even if COW is disabled.
- from what I can see, the statement
xint::integer b = a0 + a1 + ... + aN;
requires n copies of the underlying memory buffer, even though it is
possible to do zero copy without even using expression templates.
- unary operator+, operator++ and operator-- return a reference to the
object. I don't think that's a good idea, since regular integers don't
behave like this.
- I would quite like to get an interface to iterate the integer digit
per digit or byte per byte.
- XInt cannot do SBO
- Fixed-width integers still store the size etc. Ideally,
xint::integer<fixed_size<32> > should have no more overhead than int32_t.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk