Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2006-02-07 16:48:02


Hello,

The following legal snippet

#include <boost/type_traits/is_convertible.hpp>
#include <memory>

class foo{};

typedef boost::is_convertible<
  const std::auto_ptr<const foo *>,
  const foo> type;

int main()
{
  bool b=type::value;
}

makes CW 9.x and 10.0 to fail with the following
message (thanks to Noel Belcourt for his help in
getting this):

Error : function call '[std::auto_ptr<const foo *>].auto_ptr({lval}
const std::auto_ptr<const foo *>)' does not match
'std::auto_ptr<const foo *>::auto_ptr(const foo **) throw()' (explicit)
'std::auto_ptr<const foo *>::auto_ptr(std::auto_ptr<const foo *> &)
throw()'
'std::auto_ptr<const foo *>::auto_ptr<typename
__T0>(std::auto_ptr<__T1_0> &) throw()'
'std::auto_ptr<const foo *>::auto_ptr(std::auto_ptr_ref<const foo *>)
throw()'
  (point of instantiation: 'main()')
   (instantiating: 'boost::is_convertible<const std::auto_ptr<const
foo
*>, const foo>')
    
(instantiating: 'boost::detail::is_convertible_impl_dispatch<const
std::auto_ptr<const foo *>, const foo>')
     (instantiating: 'boost::detail::is_convertible_impl<const
std::auto_ptr<const foo *>, const foo>')
      (instantiating: 'boost::detail::is_convertible_basic_impl<const
std::auto_ptr<const foo *> &, const foo>')
is_convertible.hpp line 204 );

     (corresponding point of instantiation for
'boost::detail::is_convertible_basic_impl<const std::auto_ptr<const
foo
*> &, const foo>')
is_convertible.hpp line 235 );

     (corresponding point of instantiation for
'boost::detail::is_convertible_impl<const std::auto_ptr<const foo *>,
const foo>')
is_convertible.hpp line 301 : public
is_convertible_impl_dispatch_base<From, To>::type

     (corresponding point of instantiation for
'boost::detail::is_convertible_impl_dispatch<const
std::auto_ptr<const
foo *>, const foo>')
is_convertible.hpp line 348
BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::
is_convertible_impl_dispatch<From,To>::value))

     (corresponding point of instantiation for
'boost::is_convertible<const std::auto_ptr<const foo *>, const foo>')
is_convertible.cpp line 12 bool b=type::value;

Is there anything that can be done in boost::is_convertible
to workaround this problem? I've inspected the code
and seems like there's a variety of implementation
methods to choose from, but being a complete stranger
to Boost.TypeTraits I can't help much :(

Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo




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