In addition to being more consistent with our approach for helpers, this
solves an actual issue where <cmath> was using numeric_limits but never
including the <limits> header directly. In a normal setup, this is not
an issue because the <math.h> header included by <cmath> does include
<limits>. However, I did stumble upon some code where that didn't work,
most likely because they were placing their own <math.h> header in front
of ours. I didn't bother investigating further.
Details
- Reviewers
• Quuxplusone - Group Reviewers
Restricted Project - Commits
- rG81eda008e952: [libc++] Extract __clamp_to_integral to its own header
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libcxx/include/module.modulemap | ||
---|---|---|
670 | __numeric seems like a weird place for this, since IIUC it's actually used only in <random>. Shouldn't it go in __random? | |
libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp | ||
18 | This testing change implies that you meant to #include <__numeric/clamp_to_integral.h> from <numeric> (which would also be consistent with existing practice)... but you didn't. |
libcxx/include/module.modulemap | ||
---|---|---|
670 | I did that originally, but __clamp_to_integral seemed like a general algorithm that didn't belong to __random, so I changed it. I'll change it back to __random/ on the basis of "it's only used in __random" -- we can change that later if desired. | |
libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp | ||
18 | Yes, I forgot to do that indeed. Fixing, thanks. |
libcxx/include/__random/clamp_to_integral.h | ||
---|---|---|
41 | type's :) |
type's :)