[mlpack-git] [mlpack/mlpack] Automatic bindings step 2: matrix input/output parameters (#775)
Marcus Edel
notifications at github.com
Fri Sep 9 13:24:22 EDT 2016
> + // Iterate over all the program_options, looking for duplicate parameters.
> + // If we find any, remove the duplicates.
> + for (unsigned int i = 0; i < bpo.options.size(); i++)
> + {
> + for (unsigned int j = i + 1; j < bpo.options.size(); j++)
> + {
> + if (bpo.options[i].string_key == bpo.options[j].string_key)
> + {
> + // If a duplicate is found, check to see if either one has a value.
> + if (bpo.options[i].value.size() == 0 &&
> + bpo.options[j].value.size() == 0)
> + {
> + // If neither has a value, consider it a duplicate flag and remove
> + // the duplicate. It's important to not break out of this loop
> + // because there might be another duplicate later on in the vector.
> + bpo.options.erase(bpo.options.begin() + j);
I think, If we don't break, and we remove another duplicate later on in the vector, we could run into an index out of bounds error.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/775/files/67be651c4376feb8bac4f95630ab12fae553d6ec#r78216974
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160909/a15c5b39/attachment.html>
More information about the mlpack-git
mailing list