Fix destruction order problem in getCoreAllocator
[folly.git] / folly / experimental / StringKeyedMap.h
index 93d4559c310e92cc34af723cccd880e3baf3b5d7..d8b822c74474365832b21c4ec421bc537019a9bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -131,6 +131,12 @@ public:
   using Base::crbegin;
   using Base::crend;
 
+  bool operator==(StringKeyedMap const& other) const {
+    Base const& lhs = *this;
+    Base const& rhs = static_cast<Base const&>(other);
+    return lhs == rhs;
+  }
+
   // no need for copy/move overload as StringPiece is small struct
   mapped_type& operator[](StringPiece key) {
     auto it = find(key);
@@ -144,6 +150,7 @@ public:
 
   using Base::at;
   using Base::find;
+  using Base::count;
   using Base::lower_bound;
   using Base::upper_bound;
 
@@ -190,6 +197,10 @@ public:
     Base::clear();
   }
 
+  void swap(StringKeyedMap& other) & {
+    return Base::swap(other);
+  }
+
   ~StringKeyedMap() {
     // Here we assume that map doesn't use keys in destructor
     for (auto& it : *this) {