You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
std::vector<int> nums = {6,7,8,10,11}; // lost 9
boost::find_gap(nums, 6); // will point to value 10 at index 3
This function is useful for validating sorted data that are expected to be consecutive integers, for example - packet ids that might be lost, unix timestamps in a video archive that might be sparsed, etc..
The text was updated successfully, but these errors were encountered:
A decision here would be up to @mclow I belive - I just have a few comments out of curiosity. What is the purpose of the parameter i? Just a start value? Why not infer that from the start of the range or maybe have it be optionally inferred?
Also, I think this would be good to implement in terms of other algorithms. Fundamentally this is a 2-wide sliding window problem. When structured as-such, it pretty elegantly fits itself into std::adjacent_find (or the boost equivalent). Impl here: https://godbolt.org/z/4PxMT58W1
This function is useful for validating sorted data that are expected to be consecutive integers, for example - packet ids that might be lost, unix timestamps in a video archive that might be sparsed, etc..
The text was updated successfully, but these errors were encountered: