- These tests use function objects from functional, back_inserter from iterator, and equal from algorithm, so add those headers.
- The use of iota targeting vector<unsigned char> with an int parameter triggers warnings on MSVC++ assigning an into a unsigned char&; so change the parameter to unsigned char with a static_cast.
- Avoid naming unary_function in identity here as that is removed in '17. (This also fixes naming _VSTD, _NOEXCEPT_, and other libcxx-isms)
Details
- Reviewers
mclow.lists EricWF BillyONeal
Diff Detail
Event Timeline
| test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp | ||
|---|---|---|
| 36 | Pre-existing: the identity transformation is an extremely poor choice for these transform_foo tests since failure to apply the transformation exactly once to each element does not affect the result of the algorithm. | |
The use of iota targeting vector<unsigned char> with an int parameter triggers warnings on MSVC++ assigning an into a unsigned char&
I hate your compiler.
Other than that (and the bit about identity), this looks fine to me.
| test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp | ||
|---|---|---|
| 36 | I think I'd rather have this. It's constexpr and noexcept, unlike the lambda. struct identity {
template <typename T>
constexpr auto operator()(T&& x) const
noexcept(noexcept(std::forward<T>(x)))
-> decltype (std::forward<T>(x))
{ return std::forward<T>(x); }
}; | |
| 36 | I agree about the choice of identity as a transform. | |
I hate your compiler.
Seems like a valid warning to me :)
Changed predicate to one that adds 10 to each input.
| test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp | ||
|---|---|---|
| 33 | Although it doesn't matter to these tests, this notably doesn't have return type SFINAE as @mclow.lists suggested in his comment. Marshall, do you care, and if so, why? | |
It actually looks like I accidentally committed this back in January so I'm going to close this :)
Although it doesn't matter to these tests, this notably doesn't have return type SFINAE as @mclow.lists suggested in his comment. Marshall, do you care, and if so, why?