|
Boost : |
Subject: Re: [boost] [guidelines] why template errors suck
From: David Abrahams (dave_at_[hidden])
Date: 2010-09-28 14:24:49
At Tue, 28 Sep 2010 17:03:40 +0100,
Mathias Gaunard wrote:
>
> On 28/09/10 16:21, Jeremiah Willcock wrote:
>
> > The issue is that convertability constraints are too easy to get wrong
> > (within algorithms); see p. 8 of N1758 that was linked to before. You
> > can write them without is_convertible (as they were done before). Using
> > is_same<decltype(...), ...> is fine, but that might cause trouble for
> > users since now they can't return proxies (or even references) as their
> > function results. A pseudosignature-based approach allows conversions
> > both on the user side and the algorithm side without any of the
> > gyrations and subtlety that shows up with valid expressions.
>
> Just write it with a temporary variable (named or not) and avoid all the
> problems.
Exactly the kind of gyrations that algorithm authors shouldn't have to
put up with. The expression of concepts should optimize convenience
for algorithm authors, not for concept writers, since many algorithms
will use any given concept.
-- 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