Angus Leeming <[EMAIL PROTECTED]> writes:
| Angus Leeming wrote:
>> - vector<string> nvec;
>> - std::copy(bstore.begin(), bstore.end(),
>> - lyx::back_inserter_fun(nvec, &Buffer::fileName));
>> + vector<string> nvec(
>> + make_transform_iterator(bstore.begin(),
>> + bind(&Buffer::fileName,
>> _1)),
>> + make_transform_iterator(bstore.end(),
>> + bind(&Buffer::fileName, _1))
>> + );
>>
>> It's not exactly readable is it ;-)
>>
>> I've been using Boost.Spirit a lot at work recently and so have
>> become quite comfortable with Spirit's phoenix library (a better
>> lambda?)
>>
>> Try this for size:
>
| Even nicer, me thinks. Won't the std::transform call also work with
| boost.bind? I think it will. No lambda and a LOT more readable than
| the code above...
The idea is to not "create" the vector twice.
Then transform won't do.
--
Lgb