Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-09-14 08:12:14

Terje Slettebø <tslettebo_at_[hidden]> writes:

> However, the invention of enable_if [HJW03] [JWL03] (now part of Boost)
> opened the door to overloading based on arbitrary properties of types. Now,
> what we needed was techniques for detecting type properties, which could be
> used to create "concept type traits". Using this, we could have done, e.g.
> for std::sort:
> template<class Iterator>
> typename enable_if<is_random_access_iterator<Iterator> >::type
> sort(Iterator begin, Iterator end)
> {
> // ...
> }

I should have pointed to this example more specifically in my previous
message. If you had a sort overload for bidirectional iterators using
this technique, you'd have an ambiguity.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at