Boost logo

Boost :

From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2004-03-09 13:24:24


On Mar 9, 2004, at 12:17 PM, David Abrahams wrote:

> Jaakko Jarvi <jajarvi_at_[hidden]> writes:
>
>> On Mar 9, 2004, at 11:18 AM, David Abrahams wrote:
>>
>>>
>>> Lambda docs say:
>>>
>>> "When an actual argument is supplied for a placeholder, the
>>> parameter passing mode is always by reference"
>>>
>>> Yet when I changed the following code from using boost::bind to
>>> boost::lambda, I got complaints that Field is an abstract class and
>>> can't be copied.
>>>
>>> void (self_t::* insert_)(Field const&) = &self_t::insert;
>>> std::for_each(fields.begin(), fiends.end(), bind(insert_, this,
>>> _1));
>>>
>>> What gives?
>>>
>>

This requires a bigger fix.
BLL uses tuples to manipulate type sequences that are being used in
type deduction.
In this process, a tuple type containing a non-reference abstract type
is formed.
Such an object is never instantiated, but it seems that just declaring
such a type
is not allowed.

So the fix is to ditch tuples there, and move to type sequences, which
requires
quite some coding.

Is_abstract may give a quick fix.

   Jaakko

>> Can you post (email directly) a full example. I couldn't immediately
>> get similar
>> code to fail.
>
> #include <boost/lambda/lambda.hpp>
> #include <boost/lambda/bind.hpp>
>
> using namespace boost::lambda;
>
> struct X
> {
> virtual void f() = 0;
> };
>
> struct Y : X
> {
> void f() {};
> };
>
> struct Z
> {
> void g(X const& x)
> {
> }
>
> void h(X const& x)
> {
> bind(&Z::g, this, _1)(x);
> }
> };
>
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
-- Jaakko Järvi email:
jajarvi_at_[hidden]
-- Post Doctoral Fellow phone: +1 (812) 855-3608
-- Pervasive Technology Labs fax: +1 (812) 855-4829
-- Indiana University, Bloomington


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