Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Extending the library for a base class and all its derived - enable_if
From: Albert Yiamakis (vkicefire_at_[hidden])
Date: 2014-04-25 09:44:32


On 25/04/14 12:54, Avi Kivity wrote:
>
> template <typename C>
> struct range_iterator<typename enable_if<is_base_of<Base, C>::value,
> C>::type> { ... };

Boost's enable_if has no value member, you are thinking of the STL one
introduced in C++11.

> but an simpler example I tried also does not compile, complaining that
> template parameter C is not used (though it clearly is). I wonder if
> it's a bug in the error message (and the code is disallowed) or a real
> compiler bug.

Are you conjecturing wildly here? There is nothing unusual about the
error message. The documentation for enable_if is quite clear - an
additional template parameter is needed.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net