mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-04-19 15:17:31 -05:00
17 lines
514 B
C++
17 lines
514 B
C++
#pragma once
|
|
#include <json-c/json.h>
|
|
#include <memory>
|
|
|
|
namespace json
|
|
{
|
|
// Use this instead of default json_object
|
|
using Object = std::unique_ptr<json_object, decltype(&json_object_put)>;
|
|
|
|
// Use this instead of json_object_from_x. Pass the function and its arguments instead.
|
|
template <typename... Args>
|
|
static inline json::Object new_object(json_object *(*function)(Args...), Args... args)
|
|
{
|
|
return json::Object((*function)(args...), json_object_put);
|
|
}
|
|
} // namespace json
|