$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Okko Willeboordse (trash_at_[hidden])
Date: 2005-08-29 15:08:01
I have a class that has a constructor that takes a Boost function object wrapper;
class some_class
{
public:
    some_class(const boost::function1<wchar_t*, short*>& some_member)
....
I call the constructor with a member function using Boost bind.
    some_class some_object(boost::bind(&some_other_class::some_member,
                                       &some_other_object,
                                       _1));
Now I want to use some_class for some_member functions that return an other type
pointer.
So I do
class some_class
{
public:
    template <class T>
    some_class(const boost::function1<T*, short*>& get_member)
....
But now the compiler (VS 2003) starts complaining;
error C2664: 'some_class::some_class(const some_class &)' : cannot convert
parameter 1 from 'boost::_bi::bind_t<R,F,L>' to 'const some_class &'
        with
        [
            R=wchar_t *,
            F=boost::_mfi::mf1<wchar_t *,some_other_class,short *>,
            L=boost::_bi::list2<boost::_bi::list_av_2<some_other_class *__w64
,boost::arg<1>>::B1,boost::_bi::list_av_2<some_other_class *__w64
,boost::arg<1>>::B2>
        ]
        Reason: cannot convert from 'boost::_bi::bind_t<R,F,L>' to 'const
some_class'
        with
        [
            R=wchar_t *,
            F=boost::_mfi::mf1<wchar_t *,some_other_class,short *>,
            L=boost::_bi::list2<boost::_bi::list_av_2<some_other_class *__w64
,boost::arg<1>>::B1,boost::_bi::list_av_2<some_other_class *__w64
,boost::arg<1>>::B2>
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
Any ideas?
Many thanks,
Okko Willeboordse