Boost logo

Boost :

Subject: Re: [boost] [challenge!] find a common domain
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-05-19 16:27:04


On Wed, 19 May 2010, Eric Niebler wrote:

> On 5/19/2010 11:52 AM, Jeremiah Willcock wrote:
>> On Tue, 18 May 2010, Eric Niebler wrote:
>>
>> (snip)
>>
>>> Your job: implement the deduce_domain3 template that finds the common
>>> domain of 3 domains. You're allowed to use decltype, but you get bonus
>>> points for a solution that doesn't. Bonus also for instantiating fewest
>>> templates. The challenge is for the ternary case, but your solution
>>> should scale to N domains. If your solution is better than mine, I'll
>>> use it in Proto and credit you!
>>
>> My solution attempt is attached. It should be standard C++03 (no
>> decltype). The ternary case is just built as a pair of applications of
>> a binary deduce_domain2 template, so adding more parameters should be
>> straightforward.
>
> That was fast! But does it work for all cases? I'll need to plug it back
> into my test harness and see.

I hope it does; I think my tests handled all of the two-domain deductions
correctly (but check my examples too to make sure my understanding of
"correct answer" agrees with yours).

-- Jeremiah Willcock


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