Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2002-01-04 07:30:48


>Does anyone have a clue? I can see that there are different versions of
>is_convertible for almost all compilers, so was this issue encountered
>with is_convertible implementation?

is_convertible was and is a major headache to get right for multiple
compilers, I would expect is_instance_of to suffer from the same problems.
One option would be to implement is_instance_of in terms of is_convertible:

template <template <class T, class U> class f>
struct conversion_tester
{
template <class T, class U>
conversion_tester(const f<T,U>&);
};

template <class From, template <class T, class U> class To>
struct is_instance_of_2
{
BOOST_STATIC_CONSTANT(bool, value = ::boost::is_convertible<From,
::boost::conversion_tester<To> >::value);
};

be warned that I haven't tried this out though!

- John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk