Simplify Enumerator::add.
GitOrigin-RevId: c6ae056be91ba677afe11ea551c2fe376ac2406a
This commit is contained in:
parent
032aed823a
commit
20f821017d
|
@ -19,9 +19,8 @@ template <class ValueT>
|
||||||
class Enumerator {
|
class Enumerator {
|
||||||
public:
|
public:
|
||||||
using Key = int32;
|
using Key = int32;
|
||||||
template <class T>
|
|
||||||
Key add(T &&value) {
|
Key add(ValueT v) {
|
||||||
ValueT v = std::forward<T>(value);
|
|
||||||
container_->set_zero_value(&v);
|
container_->set_zero_value(&v);
|
||||||
auto it = set_.lower_bound(Key{0});
|
auto it = set_.lower_bound(Key{0});
|
||||||
container_->set_zero_value(nullptr);
|
container_->set_zero_value(nullptr);
|
||||||
|
@ -32,6 +31,7 @@ class Enumerator {
|
||||||
set_.insert(it, key);
|
set_.insert(it, key);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueT &get(Key key) {
|
ValueT &get(Key key) {
|
||||||
return container_->get_value(key);
|
return container_->get_value(key);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user