Lookup and Queries
| Method |
|---|
| Multimap |
| Returns the number of elements matching specific key |
size_type count(const key_type &p) const; |
template <class L> size_type count(const L &p) const |
| Finds element with specific key |
iterator find(const key_type &p); |
const_iterator find(const key_type &p) const; |
template <class L> iterator find(const L &p) |
template <class L> const_iterator find(const L &p) const; |
| Checks if the container contains element with specific key |
bool contains(const key_type &p) const; |
template <class L> bool contains(const L &p) const; |
| SpatialContainer |
| Get iterator to first element that passes the predicates |
const_iterator find(const predicate_list_type &ps) const noexcept; |
iterator find(const predicate_list_type &ps) noexcept; |
| Find intersection between point and container |
iterator find_intersection(const key_type &p); |
const_iterator find_intersection(const key_type &p) const; |
| Find intersection between container and query box |
iterator find_intersection(const key_type &lb, const key_type &ub); |
const_iterator find_intersection(const key_type &lb, const key_type &ub) const; |
| Find points inside a query box (excluding borders) |
iterator find_within(const key_type &lb, const key_type &ub); |
const_iterator find_within(const key_type &lb, const key_type &ub) const |
| Find points outside a query box |
iterator find_disjoint(const key_type &lb, const key_type &ub); |
const_iterator find_disjoint(const key_type &lb, const key_type &ub) const; |
| Find the elements closest to a point |
iterator find_nearest(const key_type &p); |
const_iterator find_nearest(const key_type &p) const; |
iterator find_nearest(const key_type &p, size_t k); |
const_iterator find_nearest(const key_type &p, size_t k) const; |
iterator find_nearest(const box_type &b, size_t k); |
const_iterator find_nearest(const box_type &b, size_t k) const; |
| Find min/max elements |
iterator max_element(size_t dimension) |
const_iterator max_element(size_t dimension) const |
iterator min_element(size_t dimension) |
const_iterator min_element(size_t dimension) const |
| FrontContainer |
| Find sets of dominated elements |
const_iterator find_dominated(const key_type &p) const |
iterator find_dominated(const key_type &p) |
| Find nearest point excluding \(p\) |
const_iterator find_nearest_exclusive(const key_type &p) const |
iterator find_nearest_exclusive(const key_type &p) |
| Find extreme elements |
const_iterator ideal_element(size_t d) const |
iterator ideal_element(size_t d) |
const_iterator nadir_element(size_t d) const |
iterator nadir_element(size_t d) |
const_iterator worst_element(size_t d) const |
iterator worst_element(size_t d) |
Parameters
ps- a list of predicatesp- a point of typekey_valueor convertible tokey_valuelbandub- lower and upper bounds of the query boxk- number of nearest elements
Return value
count():size_type: number of elements with a given keycontainer():bool:trueif and only if the container contains an element with the given keypfind_*:iteratorandconst_iterator- Iterator to the first element that passes the query predicatesfindreturns a normal iterator- all other
find_*functions return a query iterator (see below) size_type- Number of elements erased
Complexity
\[
O(m \log n)
\]
Notes
The front concept contains two extra functions for queries:
find_dominatedfind all points in a front dominated bypfind_nearest_exclusivefinds the point closest top, excludingpitself from the query
Info
All other definitions and requirements of a SpatialContainer also apply here.
It also contains functions to find the best and worst elements in a given dimension.
Examples
Continuing from the previous example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |