
On Tue, Oct 14, 2008 at 8:20 PM, Simonson, Lucanus J <lucanus.j.simonson@intel.com> 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
Mathias wrote: 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