Boost logo

Geometry :

Subject: Re: [geometry] Is "dimensions" signed or unsigned?
From: Patrick J. LoPresti (lopresti_at_[hidden])
Date: 2014-09-22 17:20:48

Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]> writes:

> I fixed signed/unsigned comparison in index/.../is_valid in develop
> branch.


> The problem with dimension<> metafunction is that the type of the
> value depends on the traits defined for a Geometry. For all models in
> Boost.Geometry int type is used but the user may define it as unsigned
> or size_t, etc. So I'm guessing that we can't be fully consistent
> here.

Well, it could be consistent internally... But I see the point about
user-defined types.

In fact, that is my current problem :-). From

    template <typename Geometry, int Dimensions>
    inline void assert_dimension()

For me, geometry::dimension<Geometry> is the dimension of my own type,
which I made unsigned... So the "equal_to" comparison ultimately
compares unsigned vs. signed, triggering the warning.

Similar problems occur with the functions immediately below
(assert_dimension_equal() etc.)

> Of course if you think that something could be improved, not only this
> issue, patches are more than welcome.
> In case you didn't know, here is a tutorial:

Great tutorial!

I have taken a crack at fixing the signed/unsigned warnings from
coordinate_dimension.hpp and sent the pull request.

Thanks again.

 - Pat

Geometry list run by mateusz at