Boost logo

Boost :

Subject: Re: [boost] [type_erasure] overloading macro
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2013-02-26 16:24:18


>>> It may or may not work. I've implemented
>>> most of what's necessary, but I might have
>>> missed a few things. I should get around to
>>> it within a few weeks.
>>
>> I'll be happy to test it when you have something working.
>>
>
> BOOST_TYPE_ERASURE_MEMBER now supports rvalue references.
>
> In Christ,
> Steven Watanabe

Hi Steven,

I don't manage to get it to work, am I missing something?
I get a "no matching function call" (gcc 4.7.2).

BOOST_TYPE_ERASURE_MEMBER((n1)(has_foo), foo);

struct Data{};

struct Test
{
    void foo(Data&&)const
    {
        std::cout << "foo(Data&&) called" << std::endl;
    }
    void foo(int,double)const
    {
        std::cout << "foo(int,double) called" << std::endl;
    }
};

int main()
{
    Test t;
    any<
        mpl::vector<
            n1::has_foo<void(Data&&),const _self>,
            n1::has_foo<void(int, double),const _self>,
            copy_constructible<>
>
> x (t);
    //x.foo(Data()); // ===> this will not compile
    x.foo(1,1.0); // calls foo(int, double)
    return 0;
}

Thanks,
Christophe


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