Subject: Re: [boost] [range] [general] making member functions SFINAE-friendly
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-02-18 17:39:38
on Mon Feb 18 2013, Jonathan Wakely <jwakely.boost-AT-kayari.org> wrote:
> On 18 February 2013 18:30, Andrey Semashev wrote:
>> On Monday 18 February 2013 15:05:11 Jonathan Wakely wrote:
>>> On 18 February 2013 14:33, Andrey Semashev wrote:
>>> > Yes, I'm aware of type traits. It's one thing to do tests/transforms
>>> > on types and another to test for methods presence and behavior. It's
>>> > doable but it is much more fragile and dangerous, as you have already
>>> > discovered with iterator_range.
>>> It's only fragile because iterator_range defines a member which can't be
>> No, it broke with iterator_range. It can break with other types with different
>> signatures and/or semantics of size().
> Given that I'm already requiring the type can be used with
> std::begin() and std::end(), i.e. is range-like, I'm happy to not
> support types that have a non-range-like size(). If your type quacks
> like a duck but swims like a fish it doesn't meet my requirements for
> a duck.
This sounds like the language commonly used in the Python community
about (their version of) concepts.
There's no "range-like." There's a family of Range concepts:
Maybe I'm off base here, but reading the above makes it hard for me to
hear the rest of what you wrote.
-- Dave Abrahams
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk