| 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 | |
| 38 | class Position : public Serializable { |