Boost logo

Boost :

Subject: Re: [boost] [gil] What is the status of the Gil extension numeric?
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-03-14 03:46:17


2013/3/13 Christian Henning <chhenning_at_[hidden]>

> On Wed, Mar 13, 2013 at 4:53 PM, Andrew Hundt <athundt_at_[hidden]> wrote:
> > I've been using gil for about 2 years now, and it appears the only
> > development being done on the library itself is being done by Christian
> > Henning in the io_library and some of the extensions he has created, in
> > addition to some minor fixes. I think his latest is at:
> > https://code.google.com/p/gil-contributions/
>
> The latest is on the boost trunk.

Christian, you mean the io extension, do you? I don't see numeric in trunk.

> The new io extension will be
> released either with 1.53 or 1.54. I have been travelling and I might
> have missed the deadline to include gil::io into the release branch.
> Need to check with the release team.
>
> I accordance with the original creators we have decided that I'm the
> official maintainer.
>

 I also have some comments about point2 from gil/utilities.hpp:

{{{
template <typename T>
class point2 {
public:
[...]
//--- these 3 functions don't add anything, do they? why not remove them
rely on defaults?
    point2(const point2& p) : x(p.x), y(p.y) {}
    ~point2() {}
    point2& operator=(const point2& p) { x=p.x; y=p.y; return
*this; }

[...]
    point2& operator/=(double t) { x/=t; y/=t; return
*this; }
    T x,y;
[...]
};

[...]
template <typename T> GIL_FORCEINLINE
point2<double> operator/(const point2<T>& p, double t) { return t==0 ?
point2<double>(0,0):point2<double>(p.x/t,p.y/t); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
point2<T> operator*(const point2<T>& p, std::ptrdiff_t t) { return
point2<T>(p.x*t,p.y*t); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
point2<T> operator*(std::ptrdiff_t t, const point2<T>& p) { return
point2<T>(p.x*t,p.y*t); }
}}}

So point2 has miltiplication by ptrdiff_t, and division by double. This was
very confusing for me - that multiplying point2<double> by 0.5 gave me
point2(0,0).

But this probably is as it is for a reason, so I'm not sure if my idea for
fixing this is the right way to go: I'd just add * and / for point2<T> and
T, and add multiplication by double. I'd be happy to try to implement this
change with some tests, if you think it's the right way to go ;-)

Cheers,
Kris


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