Skip to content
Browse files

folly::dynamic: use std::vector instead of folly::fbvector

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
  • Loading branch information...
1 parent 0286cb3 commit 192cff5da4fedc44707e34c9a7e0dc8ddc4e5eb7 @andrewjcg andrewjcg committed with tudor Aug 8, 2012
Showing with 8 additions and 5 deletions.
  1. +6 −2 folly/dynamic-inl.h
  2. +2 −3 folly/dynamic.h
View
8 folly/dynamic-inl.h
@@ -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) {
View
5 folly/dynamic.h
@@ -70,11 +70,11 @@
#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;

0 comments on commit 192cff5

Please sign in to comment.
Something went wrong with that request. Please try again.