void insert(const KEY &key, const VALUE &value) { erase(key); const pair_t p(key, value); auto it = std::lower_bound(m_contents.begin(), m_contents.end(), p); m_contents.insert(it, p); }
void set_add(container_t& container, typename container_t::value_type value) { auto it = container.begin(); while (it != container.end() && *it < value) { ++it; } if (*it != value) { container.insert(it, value); } }
// this insert() is called only for unexisting elements iterator_t insert(const_iterator_t position, data_t&& data) { auto distance = position - begin(); __container.insert(__position_to_iterator(position), std::move(data)); return const_cast< iterator_t >(begin()) + distance; }