|
Boost : |
Subject: Re: [boost] [type_erasure] any and shared_ptr
From: Christophe Henry (christophe.j.henry_at_[hidden])
Date: 2012-10-16 15:31:15
>> typedef mpl::vector<
>> pointer<>,
>> same_type<pointer<>::element_type,_a >,
>> relaxed_match,
>> has_foo<void()>
>> > PointeeConcept;
>>
>> // will not compile, shared_ptr<Pointee> has no foo...
>> boost::shared_ptr<Pointee> p (new Pointee) ;
>> any<PointeeConcept> ap (p);
>> ap.foo();
>>
>
> The placeholder _self maps to shared_ptr<Pointee>
> and the placeholder _a maps to Pointee.
> has_foo<void()> is actually has_foo<void(), _self>
> because of the default argument. This says
> that shared_ptr<Pointee> has a member called foo.
> What you really want is has_foo<void(), _a> to
> say that foo is a member of Pointee.
>
> In Christ,
> Steven Watanabe
Ok, got it. I made a second mistake, I need (*ap).foo();
Thanks,
Christophe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk