|
Boost : |
Subject: Re: [boost] [review][Fit] Review of Fit starts today : September 8 - September 17
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-09-16 19:31:33
On 9/16/2017 2:14 PM, P F via Boost wrote:
>
>> On Sep 15, 2017, at 8:46 PM, Edward Diener via Boost <boost_at_[hidden]> wrote:
>>
>> On 9/8/2017 7:02 AM, Matt Calabrese via Boost wrote:
>>> A formal review of the Fit library developed by Paul Fultz II starts
>>> today, September 8, and runs through September 17.
>>> A branch has been made for the review. You can find Fit for review at
>>> these links:
>>> Source: https://github.com/pfultz2/Fit/tree/boost <https://github.com/pfultz2/Fit/tree/boost>
>>> Docs: http://pfultz2.github.io/Fit/doc/html/doc/ <http://pfultz2.github.io/Fit/doc/html/doc/>
>>
>> I have some questions about Fit which I can not understand by reading the docs:
>>
>> 1) Does Fit functionality work only with function objects as opposed to callables in general ?
>
> In general yes, but its not the case for every adaptor.
OK.
>
>>
>> 2) Is the purpose of BOOST_FIT_STATIC_FUNCTION only to create a function object at global or namespace level ?
>
> Yes.
OK.
>
>>
>> 3) Does BOOST_FIT_STATIC_FUNCTION only accept a function object or does it accept any callable ?
>
> It only works with function objects, which I should document its type requirements.
Please do.
>
>>
>> 4) The documentation says that "BOOST_FIT_STATIC_LAMBDA_FUNCTION can be used to the declare the lambda as a function". I am not sure what this actually means since a lambda function is a function.
>
> Maybe that could be worded better, but it lets you declare the lambda at global or namespace scope.
OK.
>
>>
>> 5) I do not understand the purpose of the pipable adaptor. What is the point of using it ? It is mentioned as an alternative to Unified Call Syntax but, while I understand the latter, I do not understandable how pipable allows "extension methods", which is a large part of the purpose of UFCS.
>
> That is, you want to add an extension method to a class so it can be called as `x.f(y)`. With UFCS, you can just declare a free function called as `f(x, y)` and then call it as `x.f(y)`, with the Fit library you would declare the function as pipable and then call it as `x | f(y)`.
>
Let us suppose I have a class:
struct X { some member functions etc. };
Then I want to add a member function to class X with a prototype called
void f(int) so I can call it as an extension method without modifying X.
With UFCS in effect I create the free function:
void f(X px,int py) { some implementation }
and now if I have:
X x;
I can call:
x.f(3); // Works with UFCS support
successfully. Could you please show me the equivalent code that uses
pipable in this same scenario ?
>>
>> In general I am confused by what the requirements of Fit adaptors are.
>
> Which ones?
>
>> This may be because the terms "function objects" and "functions" are used in a way which does not follow standard C++ terminology as far as I know it.
>
> The type requirements for the adaptors are documented as either `ConstCallable` or `ConstFunctionObject`, which follows standard C++ definitions with an additional `const` requirement.
OK.
Thanks !
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk