Skip to content

Commit

Permalink
Revert D19965405: Fabric: Small improvements in Differentiator/TinyMap
Browse files Browse the repository at this point in the history
Differential Revision:
D19965405

Original commit changeset: 92eedf38d55b

fbshipit-source-id: 92073ca877899e2a607f283275f0d7c894dd4720
  • Loading branch information
shergin authored and facebook-github-bot committed Mar 4, 2020
1 parent 884c86a commit b8c17dd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ReactCommon/fabric/mounting/Differentiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class TinyMap final {
using Iterator = Pair *;

inline Iterator begin() {
return &vector_.front();
return (Pair *)vector_;
}

inline Iterator end() {
return &vector_.back() + 1;
return nullptr;
}

inline Iterator find(KeyT key) {
Expand All @@ -68,8 +68,11 @@ class TinyMap final {
}

inline void erase(Iterator iterator) {
*iterator = vector_.at(vector_.size() - 1);
vector_.pop_back();
static_assert(
std::is_same<KeyT, Tag>::value,
"The collection is designed to store only `Tag`s as keys.");
// Zero is a invalid tag.
iterator->first = 0;
}

private:
Expand Down

0 comments on commit b8c17dd

Please sign in to comment.