Date: Fri, 10 Apr 2015 23:11:28 +0100
On 10 April 2015 at 01:13, Nelson, Clark wrote:
> The most important change is that I have added examples for some library
> features.
>
> Now, the fact that I have dared even to attempt to write examples for C++
> library features should give anyone who knows me only moderately well some
> idea of how serious I am about considering and recording the rationale for
> all of our recommendations going forward.
The library examples look good to me, I couldn't find anything to laugh at :-)
For "N4295: Folding expressions" the motivating example from N4191
might be good:
#if __cpp_fold_expressions
template<typename... T>
auto sum(T... args) { return (args + ...); }
#else
auto sum() { return 0; }
template<typename T>
auto sum(T t) { return t; }
template(typename T, typename... Ts)
auto sum(T t, Ts... ts) { return t + sum(ts...); }
#endif
In this example, the version using a fold expression performs fewer
copies and fewer function calls.
> The most important change is that I have added examples for some library
> features.
>
> Now, the fact that I have dared even to attempt to write examples for C++
> library features should give anyone who knows me only moderately well some
> idea of how serious I am about considering and recording the rationale for
> all of our recommendations going forward.
The library examples look good to me, I couldn't find anything to laugh at :-)
For "N4295: Folding expressions" the motivating example from N4191
might be good:
#if __cpp_fold_expressions
template<typename... T>
auto sum(T... args) { return (args + ...); }
#else
auto sum() { return 0; }
template<typename T>
auto sum(T t) { return t; }
template(typename T, typename... Ts)
auto sum(T t, Ts... ts) { return t + sum(ts...); }
#endif
In this example, the version using a fold expression performs fewer
copies and fewer function calls.
Received on 2015-04-11 00:11:50