folly::dynamic: use std::vector instead of folly::fbvector
authorAndrew Gallagher <agallagher@fb.com>
Wed, 8 Aug 2012 19:05:18 +0000 (12:05 -0700)
committerTudor Bosman <tudorb@fb.com>
Wed, 8 Aug 2012 22:40:42 +0000 (15:40 -0700)
Summary:
It appears that std::unordered_map is no longer relocatable in
gcc-4.7.  Use std::vector instead, until fbvector supports non-
relocatable types.

Test Plan: Built and ran facebar tests under gcc-4.7.  Also ran folly unittests.

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D543099

folly/dynamic-inl.h
folly/dynamic.h

index 4a7c3c54194fe30ec985a27ea1420cf2a0c14ea0..94ddea4c36cdea72b2c56125bbd7ebc64e7b2584 100644 (file)
@@ -586,12 +586,16 @@ inline std::size_t dynamic::erase(dynamic const& key) {
 }
 
 inline dynamic::const_iterator dynamic::erase(const_iterator it) {
-  return get<Array>().erase(it);
+  auto& arr = get<Array>();
+  return get<Array>().erase(arr.begin() + (it - arr.begin()));
 }
 
 inline dynamic::const_iterator
 dynamic::erase(const_iterator first, const_iterator last) {
-  return get<Array>().erase(first, last);
+  auto& arr = get<Array>();
+  return get<Array>().erase(
+    arr.begin() + (first - arr.begin()),
+    arr.begin() + (last - arr.begin()));
 }
 
 inline dynamic::const_key_iterator dynamic::erase(const_key_iterator it) {
index 6a5fe0bdb5536315a81f8a555cb51ab0e7b6da84..3defcfafc8ed7271c955105e81c91a1294f39d46 100644 (file)
 #include <ostream>
 #include <type_traits>
 #include <initializer_list>
+#include <vector>
 #include <cstdint>
 #include <boost/operators.hpp>
 
 #include "folly/Traits.h"
-#include "folly/FBVector.h"
 #include "folly/FBString.h"
 
 namespace folly {
@@ -83,7 +83,6 @@ namespace folly {
 
 struct dynamic;
 struct TypeError;
-template<> FOLLY_ASSUME_RELOCATABLE(dynamic);
 
 //////////////////////////////////////////////////////////////////////
 
@@ -108,7 +107,7 @@ struct dynamic : private boost::operators<dynamic> {
    * Object item iterators dereference as pairs of (key, value).
    */
 private:
-  typedef fbvector<dynamic> Array;
+  typedef std::vector<dynamic> Array;
 public:
   typedef Array::const_iterator const_iterator;
   struct const_key_iterator;