Boost logo

Boost :

Subject: Re: [boost] [Fit] upcoming formal review for Boost.Fit
From: paul Fultz (pfultz2_at_[hidden])
Date: 2016-03-03 12:39:32

> On Wednesday, March 2, 2016 2:56 PM, Bjorn Reese <breese_at_[hidden]> wrote:
> > On 02/27/2016 05:16 PM, Vicente J. Botet Escriba wrote:
>> Documentation:
> In More Examples / Projections there is this example:
> std::sort(std::begin(people), std::end(people),
> by(&Person::year_of_birth, _ < _));
> That strikes me as a very terse syntax, where the reader could easily
> miss the fact that two values are being compared. Have you considered

> the use of placeholders like _1 and _2 instead?

They are already supported. The anonymous placeholders are only there to
describe an operator(they are not bind expressions). It could also be written
like this as well:

std::sort(std::begin(people), std::end(people),
by(&Person::year_of_birth, std::less_than<>()));

The clarity of two parameters being passed to `std::less_than` is just as
clear as when using the anonymous placeholders. The advantage of writing

`_ < _` is that it is generic, SFINAE and constexpr friendly.


Boost list run by bdawes at, gregod at, cpdaniel at, john at