Boost logo

Boost Users :

Subject: Re: [Boost-users] [lambda] Making my expression less complicated
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-09-05 12:44:24


AMDG

Peter Barker wrote:
> Hello,
>
> In my test program below, I have a container of columns and want to output the column headers into a string separated by a tab. The lambda expression is looking fairly complicated so I wonder if it could be made simpler or if there's any other algorithm I should've used to put a separator between the elements?
>

How about,

std::size_t i = 0;

//...
(
    if_(var(i)++) [ var(outputText) += constant(fieldSeparator) ],
    var(outputText) += bind(&Column::getColumnText,_1)
)

In Christ,
Steven Watanabe


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