| 409 | typename vector_type |
| 410 | > |
| 411 | void remove_long_edges ( |
| 412 | vector_type& pairs, |
| 413 | double distance_threshold |
| 414 | ) |
| 415 | { |
| 416 | vector_type temp; |
| 417 | temp.reserve(pairs.size()); |
| 418 | |
| 419 | // add all the pairs shorter than the given threshold into temp |
| 420 | for (unsigned long i = 0; i < pairs.size(); ++i) |
| 421 | { |
| 422 | if (pairs[i].distance() <= distance_threshold) |
| 423 | temp.push_back(pairs[i]); |
| 424 | } |
| 425 | |
| 426 | // move temp into the output vector |
| 427 | temp.swap(pairs); |
| 428 | } |
| 429 | |
| 430 | // ---------------------------------------------------------------------------------------- |
| 431 | |