-
Notifications
You must be signed in to change notification settings - Fork 582
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
utl:: check if container is empty on utl::shuffle #6446
utl:: check if container is empty on utl::shuffle #6446
Conversation
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
clang-tidy review says "All clean, LGTM! 👍" |
if (!congestionGridsH.empty()) { | ||
utl::shuffle(congestionGridsH.begin(), congestionGridsH.end(), g); | ||
} |
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.
It would be better to make shuffle handle the empty vector correctly so that all users don't need this check.
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.
if (n == 0) return;
should do it
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.
Thanks! I'm testing it right now and will add it to the PR soon.
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
clang-tidy review says "All clean, LGTM! 👍" |
utl::shuffle(congestionGridsV.begin(), congestionGridsV.end(), g); | ||
utl::shuffle(congestionGridsH.begin(), congestionGridsH.end(), g); | ||
utl::shuffle(congestionGridsV.begin(), congestionGridsV.end(), g); |
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.
Is this just a leftover or is there some significance to the order of these lines?
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.
Just a leftover.
Fix Coverage errors