> The technique I know relies on detecting whether the template argument
> is *derived* from some policy, and that's doable with expressions.
> That's why I asked you what was the exact technique you were using.
> Also, if you have any (other) example where "convertibility of a type"
> is needed I would be glad to see it, because this is IMHO a crucial
> point.

Yes, it's really a derived from test, so is_base_and_derived would do I
guess.  Which brings us back to things like:

template <class I>
struct is_bidirectional_iterator
{
private:
   typedef typename std::iterator_traits<I>::iterator_category cat;
public:
   BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible<cat*,
std::bidirectional_iterator_tag*>::value));
};

BTW, in any case, you can always "invent" a variable in order to make the
test, likewise I don't think there are any situations where you have a
variable and not a type.  Perhaps my main argument is philosophical:  I
think that the current solution is well understood and easy to use, and it
*conceptually* fits in well with the other type traits.  IMO a free function
is more like a code snippet that a packaged solution: but that is very much
a personal preference.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to