|
Boost : |
Subject: Re: [boost] [guidelines] why template errors suck
From: David Abrahams (dave_at_[hidden])
Date: 2010-09-28 13:37:36
At Tue, 28 Sep 2010 18:44:27 +0200,
joel falcou wrote:
>
> On 28/09/10 17:10, Stewart, Robert wrote:
> > '...one can write a sum_int_impl using this Concept...'
> >
> > "Yes and"
> >
> > '...is it too hacky?'
> >
> > "yes"
> >
> Guess I embarassed myself then *blushes*
> Why is it hacky ? The fact that second(int) return 0 ?
> Then can't we say that second(int) is ill-formed and have
> HasFirstComponent and HasSecondComponent and thus making the
> std::pair sum require AND relation ?
>
> (or am I still guessing it wrong ?)
This BehaveAsPair thing doesn't identify any real abstraction. I
promise you're not going to come across any uses for BehaveAsPair
other than in solving the exact implementation problem you're
attacking.
In short, it lacks "truthiness." :-)
Was there something unsatisfying about the solution I posted in
http://permalink.gmane.org/gmane.comp.lib.boost.devel/209012 ?
-- Dave Abrahams 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