MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / SerializeArray

Method SerializeArray

CodeFormatServer/src/LSP/LSP.h:24–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23 template<class T>
24 nlohmann::json SerializeArray(std::vector<T> &vec) {
25 nlohmann::json array = nlohmann::json::array();
26
27 for (auto &v: vec) {
28 if constexpr (std::is_base_of_v<Serializable, T>) {
29 array.push_back(v.Serialize());
30 } else {
31 array.push_back(v);
32 }
33 }
34 return array;
35 }
36};
37
38class Position : public Serializable {

Callers

nothing calls this directly

Calls 3

arrayClass · 0.50
push_backMethod · 0.45
SerializeMethod · 0.45

Tested by

no test coverage detected