You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
327 B
19 lines
327 B
#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;
|
|
}
|
|
|