|
Boost : |
Subject: Re: [boost] [challenge!] find a common domain
From: Daniel Wallin (daniel_at_[hidden])
Date: 2010-05-19 18:29:47
On Tue, May 18, 2010 at 11:02:56PM -0700, Eric Niebler wrote:
> I recently solved a devilish C++ coding problem related to the new
> sub-domain feature of Proto. I don't care for my solution, so I thought
> I'd throw it out there and see if some smart person could do better. I'm
> sending along the skeleton of the solution and some tests that it needs
> to satisfy. The rest is up to you.
>
> [...]
>
> 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.
Here's mine. It's decltype based, but I guess it could be sizeof based
in C++03.
Regards,
-- Daniel Wallin BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk