[C++-sig] Re: add_property and boost::bind?

Daniel Wallin dalwan01 at student.umu.se
Thu Aug 5 10:51:56 CEST 2004


Max Khesin wrote:
>>You can use make_function with a Signature parameter and pass that to
>>add_property.  But your bind expression above won't work.
>>
>>Maybe something like:
>>
>> 	.add_property("aaa", 
>>        make_function(
>>            boost::bind(&Foo::lookup, _1, "aaa")
>>          , default_call_policies()
>>          , mpl::vector1<int>()
>>        )
>>     )
>>
> 
> 
> This is what I was looking for. I knew my example was not complete - it was
> just wishful thinking code. But this fails to compile on vc6 & vc8, both
> pretty much indicate the same error:
> c:\home\mkhesin\libs\boost_1_31_0\boost\bind.hpp(246) : error C2784:
> 'result_traits<R,F>::type boost::_bi::list0::operator [](const
> boost::_bi::bind_t<R,F,L> &) const' : could not deduce template argument for
> 'const boost::_bi::bind_t<R,F,L> &' from 'boost::arg<I>'
>         with
>         [
>             I=1
>         ]
> 
> any idea?

I think the signature is supposed to be:

   mpl::vector2<int, Foo&>

The make_function() call above will create a nullary function, where _1
doesn't make any sense.

HTH,
-- 
Daniel Wallin




More information about the Cplusplus-sig mailing list