|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2004-11-13 19:51:27
> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Alexander Nasonov
> > > 1. Use of PP_SEQ interface to "parse" function name and arguments
> > >
> > > int X::foo(char* buf, size_t len)
> > > {
> > > BOOST_TRACE_MEM_FUN( (foo)(buf, len) );
> > ^^^^^^^^
> >
> > You can't do this without variadic macros (ala C99). We
> should have
> > these in
> > C++ eventually, but we don't right now and the pp-lib
> doesn't support them.
>
> I thought I can't but BOOST_PP_POP_FRONT( (foo)(buf, len) )
> works on gcc and sunpro!
That might work because there is no need to ever touch (buf, len). That is not
guaranteed, however.
> BOOST_PP_ELEM(1, (foo)(buf, len) ) of course doesn't work but
> BOOST_PP_ELEM(0, (foo)(buf, len) ) do.
Again, this happens to work because the implementation doesn't happen to touch
(buf, len) at all. Once again, this is not guaranteed to work. More generally,
without both variadic macros and a sequence implementation designed to handle
arbitrary-arity elements, (foo)(buf, len) is not a sequence. There are, of
course, alternatives, such as (foo)((buf)(len)).
Regards,
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk