Skip to content
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

Use prefix operators for increment/decrement #155

Merged
merged 3 commits into from
Oct 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions include/rank_filter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ inline void lineRankOrderFilter1D(const I1& src_begin, const I1& src_end,
std::deque<T> window_init(half_length_add_1);
for (size_t j = half_length_add_1; j > 0;)
{
window_init[--j] = *(src_pos++);
window_init[--j] = *src_pos;
++src_pos;
}
for (size_t j = 0; j < half_length; j++)
for (size_t j = 0; j < half_length; ++j)
{
window_iters[j] = sorted_window.insert(window_init[j]);
}
for (size_t j = half_length; j < length; j++)
for (size_t j = half_length; j < length; ++j)
{
window_iters[j] = sorted_window.insert(window_init.back());
window_init.pop_back();
Expand Down Expand Up @@ -105,7 +106,8 @@ inline void lineRankOrderFilter1D(const I1& src_begin, const I1& src_end,
// Handle special cases like reflection at the end.
if ( src_not_empty )
{
next_value = *(src_pos++);
next_value = *src_pos;
++src_pos;
src_not_empty = ( src_pos != src_end );
}
else
Expand All @@ -127,7 +129,7 @@ inline void lineRankOrderFilter1D(const I1& src_begin, const I1& src_end,
if ( rank_point == prev_iter )
{
window_iters.push_back(sorted_window.insert(next_value));
rank_point--;
--rank_point;
sorted_window.erase(prev_iter);
}
else
Expand All @@ -140,21 +142,21 @@ inline void lineRankOrderFilter1D(const I1& src_begin, const I1& src_end,
{
sorted_window.erase(prev_iter);
window_iters.push_back(sorted_window.insert(next_value));
rank_point--;
--rank_point;
}
else if ( ( rank_value >= prev_value ) && ( rank_value <= next_value ) )
{
if (rank_point == prev_iter)
{
window_iters.push_back(sorted_window.insert(next_value));
rank_point++;
++rank_point;
sorted_window.erase(prev_iter);
}
else
{
sorted_window.erase(prev_iter);
window_iters.push_back(sorted_window.insert(next_value));
rank_point++;
++rank_point;
}
}

Expand All @@ -172,7 +174,7 @@ namespace std
ostream& operator<<(ostream& out, const boost::array<T, N>& that)
{
out << "{ ";
for (unsigned int i = 0; i < (N - 1); i++)
for (unsigned int i = 0; i < (N - 1); ++i)
{
out << that[i] << ", ";
}
Expand Down