David Abrahams <[EMAIL PROTECTED]> writes:
> I'm in love with the new is_convertible; I can now detect "move-copy"
> types like auto_ptr! Could the old is_convertible do this?
>
>
> #include <boost/type_traits/is_convertible.hpp>
> #include <boost/static_assert.hpp>
> #include <memory>
>
> int main()
> {
> BOOST_STATIC_ASSERT(
> (boost::is_convertible<
> std::auto_ptr<int>, std::auto_ptr<int>
> >::value));
>
> BOOST_STATIC_ASSERT(
> (boost::is_convertible<
> std::auto_ptr<int>&, std::auto_ptr<int>
> >::value));
>
> BOOST_STATIC_ASSERT(
> (!boost::is_convertible<
> std::auto_ptr<int> const&, std::auto_ptr<int>
> >::value));
>
> BOOST_STATIC_ASSERT(
> (!boost::is_convertible<
> std::auto_ptr<int> const, std::auto_ptr<int>
> >::value));
> }
OK, I give up. This doesn't work for GCC. Does anybody have a clever
route to detecting types whose copy ctor have a non-const RHS? It's
fine to assume that an accessible copy ctor exists.
TIA,
Dave
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost