Boost logo

Boost :

Subject: [boost] [type_erasure] Using BOOST_TYPE_ERASURE_MEMBER
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2013-12-06 03:16:42


Hi,
I need some help with using BOOST_TYPE_ERASURE_MEMBER. The example in the
tutorial works as described. But the interface binds to object by
reference. But if I change it to bind by value, I get a compile-time error.

BOOST_TYPE_ERASURE_MEMBER((has_push_back), push_back, 1)
void append_many(any<has_push_back<void(int)>> container) {
    for(int i = 0; i < 10; ++i)
        container.push_back(i);}

How can I fix it? I do want to bind by value.

Regards,
&rzej


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