Archived
1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
beats-server/src/json_ext.h

19 lines
327 B
C++

#pragma once
#include "json.h"
struct Identity{
template <typename T>
T operator()(T t){
return t;
}
};
template <typename C, typename F = Identity>
inline js::Value vector_to_json(C const & container, F f = Identity()){
js::Array array;
for(auto x : container){
array.push_back(to_json(f(x)));
}
return array;
}