typedef std::vector<dynamic> Array;
public:
typedef Array::const_iterator const_iterator;
+ typedef dynamic value_type;
struct const_key_iterator;
struct const_value_iterator;
struct const_item_iterator;
#include "folly/Benchmark.h"
#include "folly/dynamic.h"
+#include "folly/gen/Base.h"
#include "folly/json.h"
using folly::dynamic;
EXPECT_EQ(dynamic(2), *cobject.get_ptr("two"));
}
+TEST(Dynamic, ArrayGenerator) {
+ // Make sure arrays can be used with folly::gen.
+ using namespace folly::gen;
+ dynamic arr { 1, 2, 3, 4 };
+ EXPECT_EQ(from(arr) | take(3) | member(&dynamic::asInt) | sum, 6);
+}
+
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);