-
Notifications
You must be signed in to change notification settings - Fork 40
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
bring efel to c++17 standard #327
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8bfe7a4
Set C++17 standard
anilbey 3f5e15a
Fix efel logging on windows for caching test
anilbey 9944511
remove unused using std::greater_equal statements
anilbey 536e45b
add using std::distance to LibV1
anilbey bd8b522
fix indentation in LibV1
anilbey 6affd2a
Merge branch 'master' into c++17
anilbey aa7bcc0
using std::distance in LibV5
anilbey d3a726f
using std::find_if in LibV5
anilbey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,11 +29,7 @@ | |
#include <sstream> | ||
#include <iomanip> | ||
|
||
using std::bind2nd; | ||
using std::find_if; | ||
using std::greater; | ||
using std::greater_equal; | ||
using std::less_equal; | ||
using std::list; | ||
using std::min_element; | ||
using std::max_element; | ||
|
@@ -378,7 +374,7 @@ static int __AHP_depth_abs_slow_indices(const vector<double>& t, | |
distance(t.begin(), | ||
find_if(t.begin() + peakindices[i + 1], | ||
t.begin() + peakindices[i + 2], | ||
bind2nd(greater_equal<double>(), t_start))), | ||
[t_start](double val) { return val >= t_start; })), | ||
v.begin() + peakindices[i + 2])); | ||
} | ||
return adas_indices.size(); | ||
|
@@ -983,10 +979,11 @@ static int __time_constant(const vector<double>& v, const vector<double>& t, | |
// int stimendindex; | ||
// for(stimendindex = 0; t[stimendindex] < stimEnd; stimendindex++) ; | ||
// int stimmiddleindex = (stimstartindex + stimendindex) / 2; | ||
int stimmiddleindex = distance( | ||
t.begin(), | ||
find_if(t.begin() + stimstartindex, t.end(), | ||
bind2nd(greater_equal<double>(), (stimStart + stimEnd) / 2.))); | ||
double mid_stim = (stimStart + stimEnd) / 2.; | ||
auto it_mid_stim = find_if(t.begin() + stimstartindex, t.end(), | ||
[mid_stim](double val) { return val >= mid_stim; }); | ||
int stimmiddleindex = distance(t.begin(), it_mid_stim); | ||
|
||
if (stimstartindex >= v.size() || stimmiddleindex < 0 || | ||
static_cast<size_t>(stimmiddleindex) >= v.size()) { | ||
return -1; | ||
|
@@ -1006,13 +1003,13 @@ static int __time_constant(const vector<double>& v, const vector<double>& t, | |
// find start of the decay | ||
int i_start = 0; | ||
while (find_if(dvdt.begin() + i_start, dvdt.begin() + i_start + 5, | ||
bind2nd(greater<double>(), -min_derivative)) != | ||
dvdt.begin() + i_start + 5) { | ||
if (dvdt.begin() + i_start + 5 == dvdt.end()) { | ||
GErrorStr += "Could not find the decay.\n"; | ||
return -1; | ||
} | ||
i_start++; | ||
[min_derivative](double val) { return val > -min_derivative; }) != | ||
dvdt.begin() + i_start + 5) { | ||
if (dvdt.begin() + i_start + 5 == dvdt.end()) { | ||
GErrorStr += "Could not find the decay.\n"; | ||
return -1; | ||
} | ||
i_start++; | ||
} | ||
// find the flat | ||
// bool foundflat = false; | ||
|
@@ -1441,11 +1438,9 @@ static int __AP_width(const vector<double>& t, const vector<double>& v, | |
if (strict_stiminterval){ | ||
int start_index = distance( | ||
t.begin(), | ||
find_if(t.begin(), t.end(), bind2nd(greater_equal<double>(), stimstart))); | ||
int end_index = | ||
distance(t.begin(), | ||
find_if(t.begin(), t.end(), | ||
std::bind2nd(std::greater_equal<double>(), stimend))); | ||
find_if(t.begin(), t.end(), [stimstart](double x){ return x >= stimstart; })); | ||
int end_index = distance(t.begin(), find_if(t.begin(), t.end(), | ||
[stimend](double x){ return x >= stimend; })); | ||
indices.push_back(start_index); | ||
for (size_t i = 0; i < minahpindices.size(); i++) { | ||
if (start_index < minahpindices[i] && minahpindices[i] < end_index) { | ||
|
@@ -1470,14 +1465,14 @@ static int __AP_width(const vector<double>& t, const vector<double>& v, | |
v.begin() + indices[i + 1], bind2nd(less_equal<double>(), v_hm))); | ||
apwidth.push_back(t[hm_index2] - t[hm_index1]); | ||
*/ | ||
int onset_index = distance( | ||
v.begin(), find_if(v.begin() + indices[i], v.begin() + indices[i + 1], | ||
bind2nd(greater_equal<double>(), threshold))); | ||
auto onset_index = std::distance( | ||
v.begin(), std::find_if(v.begin() + indices[i], v.begin() + indices[i + 1], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why use std:: here? You did not use it for the other changes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in the next commit. The usage is now consistent within LibV1 |
||
[threshold](double x){ return x >= threshold; })); | ||
// int end_index = distance(v.begin(), find_if(v.begin() + peakindices[i], | ||
// v.begin() + indices[i + 1], bind2nd(less_equal<double>(), threshold))); | ||
int end_index = distance( | ||
v.begin(), find_if(v.begin() + onset_index, v.begin() + indices[i + 1], | ||
bind2nd(less_equal<double>(), threshold))); | ||
auto end_index = std::distance( | ||
v.begin(), std::find_if(v.begin() + onset_index, v.begin() + indices[i + 1], | ||
[threshold](double x){ return x <= threshold; })); | ||
apwidth.push_back(t[end_index] - t[onset_index]); | ||
} | ||
return apwidth.size(); | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
why the indentation here?
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 I got confused with 4spaces vs 2 spaces indentation. Let me take it back