-
Notifications
You must be signed in to change notification settings - Fork 58
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
cleaning(simple-kernel-timer): promote find_index
to kp_shared.hpp
#227
Conversation
3ece467
to
0081370
Compare
@masterleinad I have |
See #228. |
0081370
to
32afcf6
Compare
@dalg24 Could you have a look and merge if all is fine for you? Thanks ! |
const auto it = | ||
std::find_if(kernels.begin(), kernels.end(), [&](const auto& kernel) { | ||
return strcmp(kernel->getName(), kernelName) == 0; | ||
}); | ||
return it == kernels.cend() ? -1 : std::distance(kernels.begin(), 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.
I see little benefit from changing the original implementation
const auto it = | |
std::find_if(kernels.begin(), kernels.end(), [&](const auto& kernel) { | |
return strcmp(kernel->getName(), kernelName) == 0; | |
}); | |
return it == kernels.cend() ? -1 : std::distance(kernels.begin(), it); | |
for (unsigned int i = 0; i < kernels.size(); i++) { | |
KernelPerformanceInfo* nextKernel = kernels[i]; | |
if (strcmp(nextKernel->getName(), kernelName) == 0) { | |
return i; | |
} | |
} | |
return -1; |
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 meant to apply the suggestion and merge but somehow I don't see the option to do so in the GH interface.
@@ -17,8 +17,11 @@ | |||
#ifndef _H_KOKKOSP_KERNEL_SHARED | |||
#define _H_KOKKOSP_KERNEL_SHARED | |||
|
|||
#include <algorithm> |
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.
#include <algorithm> |
32afcf6
to
8bb7ffc
Compare
As suggested by @masterleinad in #225.