Boost logo

Boost :

Subject: Re: [boost] A design for geometric objects
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-12-05 20:25:41


Mathias wrote:
>Overloading certainly is ad-hoc polymorphism with multiple-dispatch
>based on the static type.
>So yes.
>However, isn't this ambiguous?
>A 90 degree polygon should match all three overloads.

Yes, a single 90 degree polygon should match all three overloads, but two 90 degree polygons can only match the correct operator. Each operator takes two arguments.

is_either_polygon_45_set_type<T1, T2> evaluates to a type only if one or the other or both T1 and T2 are of 45 degree flavor. That means that two 90 degree polygons can't instantiate a function that requires is_either_polgyon_45_set_type on its two arguments. Similarly with is_either_polygon_set_type, only if one of the arguments is of arbitrary angle flavor will the arbitrary angle intersection operator be instantiated.

Luke


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