Skip to content

Modifiers

Method
Container + AllocatorAwareContainer
Exchanges the contents of the container with those of rhs
void swap(kd_tree &rhs) noexcept;
Multimap
Erases all elements from the container
void clear();
Inserts element(s) into the container
iterator insert(const value_type &v);
iterator insert(value_type &&v);
template <class P> iterator insert(P &&v);
iterator insert(iterator, const value_type &v);
iterator insert(const_iterator, const value_type &v);
iterator insert(const_iterator, value_type &&v);
template <class P> iterator insert(const_iterator hint, P &&v);
template <class Inputiterator> void insert(Inputiterator first, Inputiterator last);
void insert(std::initializer_list<value_type> init);
Inserts a new element into the container constructed in-place with the given args
template <class... Args> iterator emplace(Args &&...args);
template <class... Args> iterator emplace_hint(const_iterator, Args &&...args);
Removes specified elements from the container
iterator erase(const_iterator position);
iterator erase(iterator position);
iterator erase(const_iterator first, const_iterator last);
size_type erase(const key_type &k);
Attempts to extract ("splice") each element in source and insert it into *this
void merge(front &source) noexcept;
void merge(front &&source) noexcept;

Parameters

  • rhs - container to exchange the contents with
  • v - element value to insert
  • first, last - range of elements to insert/erase
  • init - initializer list to insert the values from
  • hint - iterator, used as a suggestion as to where to start the search
  • position - iterator pointer to element to erase
  • k - key value of the elements to remove
  • source - container to get elements from

Return value

  • iterator - Iterator to the new element (insert) or following the last removed element (erase)
  • size_type - Number of elements erased

Complexity

  • insert, emplace, erase: \(O(m \log n)\)
  • swap: \(O(1)\)
  • merge: \(O(mn)\)

Notes

The insertion operator will already remove any points that are dominated by the new point so that the front invariants are never broken. For this reason, unlike in a spatial container, the insertion operator might fail in fronts. This insert function returns an iterator to the new element and a boolean indicating if an element has been inserted.

Example

Continuing from the previous example:

1
2
pf.insert({ {1.49101, 3.24052, 0.724771}, 24});
pf.erase({1.49101, 3.24052, 0.724771});
1
2
pf.insert([pareto.point([1.49101, 3.24052, 0.724771]), 24])
del pf[1.49101, 3.24052, 0.724771]