Boost logo

Boost Users :

Subject: Re: [Boost-users] Metaprogramming Question
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-02-09 23:05:53


On 2/9/2012 1:49 PM, Nat Linden wrote:

>
> OURMACRO("some streaming expr " << value << ...);
>
> that would stream arbitrary objects as in:
>
> hidden_ostream_object << "some streaming expr " << value << ...;
>
> His solution is like this:
>
> template <typename FUNCTOR>
> void ourmacro_f(const FUNCTOR& f)
> {
> f(hidden_ostream_object);
> }
>
> #define OURMACRO(EXPRESSION) (ourmacro_f(boost::lambda::_1 << EXPRESSION))\

How is that different from just using:

        #define OURMACRO(EXPRESSION) hidden_stream_object << EXPRESSION


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net