hinted insert operations for flat_set

This commit is contained in:
Alex Coyte 2016-09-01 14:40:17 +10:00 committed by Matthew Barr
parent 707fe675ea
commit aca89e66d2

View File

@ -207,6 +207,10 @@ public:
return std::make_pair(iterator(it), false); return std::make_pair(iterator(it), false);
} }
iterator insert(UNUSED const_iterator hint, const value_type &value) {
return insert(value).first;
}
std::pair<iterator, bool> insert(value_type &&value) { std::pair<iterator, bool> insert(value_type &&value) {
auto it = std::lower_bound(data.begin(), data.end(), value, comp); auto it = std::lower_bound(data.begin(), data.end(), value, comp);
if (it == data.end() || comp(value, *it)) { if (it == data.end() || comp(value, *it)) {
@ -216,6 +220,10 @@ public:
return std::make_pair(iterator(it), false); return std::make_pair(iterator(it), false);
} }
iterator insert(UNUSED const_iterator hint, value_type &&value) {
return insert(value).first;
}
template <class InputIt> template <class InputIt>
void insert(InputIt first, InputIt second) { void insert(InputIt first, InputIt second) {
for (; first != second; ++first) { for (; first != second; ++first) {