Boost logo

Boost :

Subject: Re: [boost] Preview 3 of the Geometry Library
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2008-10-14 21:10:24


On Tue, Oct 14, 2008 at 8:20 PM, Simonson, Lucanus J
<lucanus.j.simonson_at_[hidden]> wrote:
> Mathias wrote:
>>- Why can objects be default-constructible?
>>...
>>- centroid says it throws an exception if the polygon does not contain
>>any point. But how can a polygon not contain any points!?
>>The constructor of a polygon should force it to have at least one
> point.
>
> Obviously, a default constructed polygon contains no points. Polygons
> have to be default constructible so that they can be elements of a std
> container. Objects that are not default constructible are a pain. I
> have to deal with a legacy polygon type that is not default
> constructible, so I have a very clear idea about which way I prefer and
> why.

STD library containers don't need DefaultConstructible, only
CopyConstructible and
sometimes Assignable.

Could the algorithms be written in such a way that they didn't care
whether the polygon type was DefaultConstructible? Is there a
different motivating reason to allow empty polygons than dealing with
a legacy class?

--Michael Fawcett


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