Boost logo

Boost :

Subject: Re: [boost] A design for geometric objects
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-12-06 00:39:59

On Dec 4, 2008, at 2:05 PM, Simonson, Lucanus J wrote:
>> These operators are overloaded with SFINAE on return type such that
>> three intersection operators are sufficient to cover all valid
>> combinations of any geometry type, rectangle, six flavors of
>> polgyons with and without holes in the manhattan, 45, or general
>> domains, and std containers thereof as well as my data structures
>> that serve as the inputs to the boolean algorithms

Gordon wrote:
>This approach leads to an combinatorial number of overloads, does it
>not? Surely there must be a way to do static multiple dispatch using
>metaprogramming instead.

No, there are three algorithms and three overloads. Any combination of many possible inputs resolves to the correct algorithm through metaprogramming. This operator API is concepts based. Previously I had a real problem with tag dispatching leading to exactly the problem you call out where a combinatorial number of overloads was required. Concepts is much more powerful than tag dispatching and got the number of functions I needed to type down to linear to the number of algorithms I wanted to expose. As it is I got a repetitive stress injury from typing typename, typedef ::type the < > and _ chars and saving ever twenty seconds with :w because I'm a vi user.


Boost list run by bdawes at, gregod at, cpdaniel at, john at