rsmith added inline comments.
================
Comment at: include/numeric:145
+{
+ return reduce(__first, __last, __init, _VSTD::plus<>());
+}
----------------
Missing _VSTD::
================
Comment at: include/numeric:153
+{
+ return reduce(__first, __last,
+ typename iterator_traits<_InputIterator>::value_type{},
_VSTD::plus<>());
----------------
Missing _VSTD::
================
Comment at: include/numeric:209
+{
+ return transform_reduce(__first1, __last1, __first2, __init,
_VSTD::plus<>(), _VSTD::multiplies<>());
+}
----------------
Missing _VSTD::
================
Comment at: test/std/numerics/numeric.ops/reduce/reduce_iter_iter.pass.cpp:26
+{
+ static_assert( std::is_same<typename
std::iterator_traits<decltype(first)>::value_type,
+ decltype(std::reduce(first, last))>::value, ""
);
----------------
Maybe use _v trait?
================
Comment at: test/std/numerics/numeric.ops/reduce/reduce_iter_iter.pass.cpp:27
+ static_assert( std::is_same<typename
std::iterator_traits<decltype(first)>::value_type,
+ decltype(std::reduce(first, last))>::value, ""
);
+ assert(std::reduce(first, last) == x);
----------------
May as well drop the `, ""` since this test requires C++17 anyway.
================
Comment at: test/std/numerics/numeric.ops/reduce/reduce_iter_iter.pass.cpp:37
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ test(Iter(ia), Iter(ia), 0);
+ test(Iter(ia), Iter(ia+1), 1);
----------------
wash wrote:
> Just to confirm, this should be 0 because the "default" init value is
> `iterator_traits<_InputIterator>::value_type{}`, and `int{}` gives you a
> determinate result (as opposed to `int()` which would not), correct?
`int()` also gives a determinate result.
================
Comment at:
test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp:36
+ _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x)))
+ -> decltype (_VSTD::forward<_Tp>(__x))
+ { return _VSTD::forward<_Tp>(__x); }
----------------
Maybe use `decltype(auto)` here?
================
Comment at:
test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp:41
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ assert(sa == sizeof(ua) / sizeof(ua[0])); // just to be sure
+
----------------
You could static_assert this if you make sa const.
https://reviews.llvm.org/D33997
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits