Enable floating point ranges#1776
Merged
horenmar merged 2 commits intocatchorg:masterfrom Oct 27, 2019
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1776 +/- ##
==========================================
- Coverage 87.97% 85.86% -2.11%
==========================================
Files 138 131 -7
Lines 5468 3754 -1714
==========================================
- Hits 4810 3223 -1587
+ Misses 658 531 -127 |
Member
|
Actually it does not support floating point numbers intentionally. The original PR had no limits on the generator, but I wanted to avoid bug reports from people who'd use the generator for floating point numbers, without taking proper care of edge conditions caused by floating point rounding. This is incidentally also why the static assert is placed in the helper function and not in the generator class itself -- it allows advanced users to create the generator manually if needed. I'll think about lifting the restriction. |
204595b to
6a08225
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The generator helper
range(start, end, step)currently only supports integer ranges.This seems to be an artificial limitation, as the underlying
RangeGenerator<T>works fine also for floating point types.This PR changes the
static_assertthat limits the types forrange(start, end, step)to also support floating point types. It also introduces additional tests to cover the extended functionality.