Commit 192cff5d authored by Andrew Gallagher's avatar Andrew Gallagher Committed by Tudor Bosman

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
parent 0286cb33
...@@ -586,12 +586,16 @@ inline std::size_t dynamic::erase(dynamic const& key) { ...@@ -586,12 +586,16 @@ inline std::size_t dynamic::erase(dynamic const& key) {
} }
inline dynamic::const_iterator dynamic::erase(const_iterator it) { 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 inline dynamic::const_iterator
dynamic::erase(const_iterator first, const_iterator last) { 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) { inline dynamic::const_key_iterator dynamic::erase(const_key_iterator it) {
......
...@@ -70,11 +70,11 @@ ...@@ -70,11 +70,11 @@
#include <ostream> #include <ostream>
#include <type_traits> #include <type_traits>
#include <initializer_list> #include <initializer_list>
#include <vector>
#include <cstdint> #include <cstdint>
#include <boost/operators.hpp> #include <boost/operators.hpp>
#include "folly/Traits.h" #include "folly/Traits.h"
#include "folly/FBVector.h"
#include "folly/FBString.h" #include "folly/FBString.h"
namespace folly { namespace folly {
...@@ -83,7 +83,6 @@ namespace folly { ...@@ -83,7 +83,6 @@ namespace folly {
struct dynamic; struct dynamic;
struct TypeError; struct TypeError;
template<> FOLLY_ASSUME_RELOCATABLE(dynamic);
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
...@@ -108,7 +107,7 @@ struct dynamic : private boost::operators<dynamic> { ...@@ -108,7 +107,7 @@ struct dynamic : private boost::operators<dynamic> {
* Object item iterators dereference as pairs of (key, value). * Object item iterators dereference as pairs of (key, value).
*/ */
private: private:
typedef fbvector<dynamic> Array; typedef std::vector<dynamic> Array;
public: public:
typedef Array::const_iterator const_iterator; typedef Array::const_iterator const_iterator;
struct const_key_iterator; struct const_key_iterator;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment