![]() |
Boost : |
From: Jean-Louis Leroy (jl_at_[hidden])
Date: 2025-05-06 22:52:39
Hi Steven,
> > I tried since you last suggested this. Couldn't make it work. The macro
> > generates something like:
> >
> > auto poke(std::ostream& a, virtual_ptr<Animal> b) -> void {
> > method<poke_method(std::ostream& a, virtual_ptr<Animal> b)>::fn(a, b);
> > }
> >
> > There is no way to peel off the `void` from the signature with the syntax you
> > suggest.
> >
>
> It doesn't need to be peeled off by the macro. You're only using it
> as a template parameter, so you can just pass the whole signature
> as a function type.
What about the `void` after the arrow?
It might work if we could define a function using a function type:
using Signature = void(std::ostream& a, virtual_ptr<Animal> b);
Signature poke {
method<poke_method(std::ostream& a, virtual_ptr<Animal> b)>::fn(a, b);
}
Alas this is illegal. Not sure why. Probably because of the parameter names...
For what it's worth, here is the syntax that I would like:
BOOST_OPENMETHOD(void poke(std::ostream&,virtual_ptr<Animal>)) { ... }
J-L
On Tue, May 6, 2025 at 5:34â¯PM Steven Watanabe via Boost
<boost_at_[hidden]> wrote:
>
> AMDG
>
> On 4/30/25 4:15 PM, Jean-Louis Leroy via Boost wrote:
> > Hi JoaquÃn,
> >
> > * Instead of BOOST_OPENMETHOD(poke, (std::ostream&,virtual_ptr<Animal>), void),
> > consider the possibility of using BOOST_OPENMETHOD(poke, void(std::ostream&,
> > virtual_ptr<Animal>)).
> >
> > I tried since you last suggested this. Couldn't make it work. The macro
> > generates something like:
> >
> > auto poke(std::ostream& a, virtual_ptr<Animal> b) -> void {
> > method<poke_method(std::ostream& a, virtual_ptr<Animal> b)>::fn(a, b);
> > }
> >
> > There is no way to peel off the `void` from the signature with the syntax you
> > suggest.
> >
>
> It doesn't need to be peeled off by the macro. You're only using it
> as a template parameter, so you can just pass the whole signature
> as a function type.
>
> In Christ,
> Steven Watanabe
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk