Boost logo

Boost :

Subject: Re: [boost] [Fit] Review
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2016-03-11 02:01:29

Le 11/03/2016 06:10, Paul Fultz II a écrit :
>>> We can define functions by simply composing other functions together and
>> we
>>> don't need to write awkward syntax nor template boilerplate for it. For
>>> example, we can simply write `make_tuple` like this:
>>> BOOST_FIT_STATIC_FUNCTION(make_tuple) = by(decay,
>>> construct<std::tuple>());
>> What is the type of by(decay,construct<std::tuple>()) ?
> It is something like `by_adaptor<decltype(decay), construct<std::tuple>>`.
>> I thought I would be able to write locally:
>> auto make_tuple(by(decay,construct<std::tuple>()));
>> but evidently you are saying that does not work.
> That is not what I am saying at all. It can work, the functions can be used
> locally, like in the first example. However, for `make_tuple` this is not
> useful at all.
Let people consider what is useful or not. Naming the local functions
could make the code more readable sometimes.
> If `std::make_tuple` was assigned to a local variable then no
> one could ever call the function. So you use global function objects when
> you
> want to make the function available for consumption by others. And the
> advantage of defining `make_tuple` this way over writing it as it is written
> currently in the standard library, is that we can avoid all the template
> boilerplate involved with this.
This is style question that should be out of the scope of the library.
The library must show what can be done with it.


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