19using Json = nlohmann::json;
26static inline void json_dump(std::string
const& file_name,
const Json& data)
28 std::ofstream o(file_name +
".json");
45 auto pos_json = file_name.find_last_of(
".json");
46 auto not_json = (file_name.size() - 1!=pos_json);
47 if (not_json) { file_name = file_name +
".json"; }
48 std::ifstream o(file_name);
64[[maybe_unused]]
static bool is_member(std::vector<T>
const& v, T
const& el){
65 return (std::find(v.begin(),v.end(), el) != v.end());
static void json_dump(std::string const &file_name, const Json &data)
Simple wrapper function around Json objects built in dump() method.
Definition utils.hpp:26
static bool is_member(std::vector< T > const &v, T const &el)
Convenient wrapper around std::find, which only works for std::vectors.
Definition utils.hpp:64
nlohmann::json Json
shortening of the nlohmann::json namespace, which is an external open source library bundled by flipp...
Definition Nodes.hpp:17
static Json json_read(std::string file_name)
Simple wrapper function that reads the content of a text file into a json object.
Definition utils.hpp:43
Definition custom_concepts.hpp:8