-
Notifications
You must be signed in to change notification settings - Fork 50
Optimized version of index_set_to_selection #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
Optimized version of index_set_to_selection #58
Conversation
…ndex_set. Sort and unique an index_set if it's not guaranteed to be so
return result; | ||
} | ||
|
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.
Should add a comment here about what this algorithm does.
…meeting the preconditions
\ingroup selection_algorithms | ||
|
||
OLD VERSION (before September 2016) Takes a set of indices and converts them to a boundary-based Selection | ||
*/ | ||
template <typename Selection, typename ForwardRange> |
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 remove the old version - it is quadratic and of no use anymore.
… the iterator-based signature
} | ||
|
||
/****************************************************************************************************/ | ||
/*! | ||
\ingroup selection_algorithms | ||
|
||
Takes a set of indices and converts them to a boundary-based Selection | ||
Takes a boundary-based Selection and converts them to a set of indices |
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.
Updated the function description + added example usage.
Looks good to me - definitely an improvement over what we have now. @sean-parent? |
@sean-parent @fosterbrereton Ping. Using it in our code, works great. |
index_set
if it's not guaranteed to be strictly increasing.index_set
is known to be strictly increasing already,strictly_increasing_index_set_to_selection()
function may be used to skipstd::sort
andstd::unique
calls.