-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplementing RangeGenerator #1526
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1526 +/- ##
=======================================
Coverage 80.58% 80.58%
=======================================
Files 121 121
Lines 3383 3383
=======================================
Hits 2726 2726
Misses 657 657 |
Codecov Report
@@ Coverage Diff @@
## master #1526 +/- ##
=======================================
Coverage 80.54% 80.54%
=======================================
Files 121 121
Lines 3386 3386
=======================================
Hits 2727 2727
Misses 659 659 |
@@ -349,6 +349,53 @@ namespace Generators { | |||
); | |||
} | |||
|
|||
template <typename T> | |||
class RangeGenerator final : public IGenerator<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it should be limited only for arithmetic types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer to keep it open for anything that provides the correct interface. This way someone can still use it with their own classes, such as a BigInteger
. A rare use case, but I think trying to prevent someone from putting a string in it isn't going to help anyone either.
But that's my opinion, if you really want me to I can always add a static_assert
with std::is_arithmetic
.
Add also a documentation and example for this. |
I have removed the possibility to use anything other than integers as requested. |
I am back. Apart from the two lines with hard tabs, this looks good and definitely mergeable. However, I remember from Discord that you wanted the I think we can compromise by forcing the helper to do the checking for integralness of the types -- doing so would ensure that users wouldn't be bitten by something like |
I made the mentioned changes and squashed the PR together, gonna merge it later after it goes through CI. |
Description
The RangeGenerator was lost during the refactor of the generator interface. I've re-implemented it using the new generator interface. I have also extended it by adding an optional step size.
If it is satisfactory then I will update the documentation as well.
GitHub Issues
Disappeared in #1516