Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2006-04-13 05:49:07


----- Mensaje original -----
De: Alexei Alexandrov <alexei.alexandrov_at_[hidden]>
Fecha: Miércoles, Abril 12, 2006 7:17 pm
Asunto: Re: [boost][multi_index] Problems with chained pointers in
multi index from 1.34 RC

> JOAQUIN LOPEZ MU?Z <joaquin <at> tid.es> writes:
>
> >
> > 1. What is the compiler error you're getting?
>
> > Now, from what you report, seems the restriction is
> > being too much comprehensive. Could you test what is the
> > value of
> >
> > boost::is_convertible<
> > const name_record::Ptr,
> > const name_record
> > >::value
> >
> > on your compiler?
>
> No, this thing compiles and expands to false as expected. In fact,
> the error
> I'm getting is about
>
> boost/boost/type_traits/is_convertible.hpp(254): error: class
> "name_record" has
> no suitable copy constructor
> BOOST_STATIC_CONSTANT(bool, value =
> ^
> detected during:
> instantiation of
> class "boost::detail::is_convertible_basic_impl<From, To> [with
> From=boost::detail::is_convertible_impl<const name_record, const
> name_record>::ref_type, To=const name_record]" at line 286
> instantiation of class
> "boost::detail::is_convertible_impl<From,
> To> [with From=const name_record, To=const name_record]" at line 362
> instantiation of
> class "boost::detail::is_convertible_impl_dispatch<From, To> [with
> From=const
> name_record, To=const name_record]" at line 409
> instantiation of class "boost::is_convertible<From,
> To> [with
> From=const name_record, To=const name_record]" at line 59 of
> "D:\src\3rd-
> parties\boost/boost/utility/enable_if.hpp"
>
> and can be reproduced with
>
> bool br = boost::is_convertible<
> const name_record,
> const name_record
> >::value;
>
> It fails to compile as well. It seems that is_convertible doesn't
> handle
> noncopyable target type well.

I guess you mean the source type (i.e. the From argument.)
Well, this also explains the problems you're getting, and
it's a serious issue (IMHO) with boost::is_convertible. I'll
report this in a separate post.

In the meantime, I guess you can work around the problem by
specializing
boost::is_convertible<const name_record,const name_record>
like this:

namespace boost{

template<>
struct is_convertible<
  const name_record,
  const name_record
>: public true_type{};

}

This tecnhique is sanctioned at

http://boost.org/doc/html/boost_typetraits/user_defined.html

HTH,

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