|
Boost : |
Subject: Re: [boost] [range] [general] making member functions SFINAE-friendly
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-02-18 13:56:10
AMDG
On 02/18/2013 10:15 AM, Jonathan Wakely wrote:
> On 18 February 2013 18:04, Dave Abrahams wrote:
>>
>>> However, if detecting whether "r.size()" is a valid expression
>>> cannot be done reliably (for example, if we determine that for
>>> iterator_range<I> where I is not random-access it is a valid
>>> expression, but then that static-asserts on us), then we
>>> can't use this approach.
>>
>> Then you can't use this approach (in general).
>
> Why? What other range-like types provide an size() member that
> appears to be callable but must not be called?
>
That's irrelevant. The point is that the range
concepts provide no such requirement. It is unsafe
to rely on any behavior which is not intentional and
explicitly documented, /especially/ with generic code.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk