0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 23:44:01 +01:00

ircd::json: Cleanup members typedefs / construction stack.

This commit is contained in:
Jason Volk 2019-03-28 20:15:22 -07:00
parent 94503e6d5f
commit 653c0bc3cc
3 changed files with 10 additions and 10 deletions

View file

@ -14,7 +14,7 @@
namespace ircd::json namespace ircd::json
{ {
struct member; struct member;
using members = std::initializer_list<member>; using members = std::initializer_list<const member>;
bool operator==(const member &a, const member &b); bool operator==(const member &a, const member &b);
bool operator==(const member &a, const string_view &b); bool operator==(const member &a, const string_view &b);
@ -63,24 +63,24 @@ ircd::json::member::member(const string_view &key,
template<class V> template<class V>
ircd::json::member::member(const string_view &key, ircd::json::member::member(const string_view &key,
V&& v) V&& v)
:std::pair<value, value> :member
{ {
{ key, json::STRING }, std::forward<V>(v) key, value { std::forward<V>(v) }
} }
{} {}
inline inline
ircd::json::member::member(const object::member &m) ircd::json::member::member(const object::member &m)
:std::pair<value, value> :member
{ {
{ m.first, json::STRING }, value { m.second, type(m.second) } m.first, value { m.second, type(m.second) }
} }
{} {}
inline inline
ircd::json::member::member(const string_view &k) ircd::json::member::member(const string_view &k)
:std::pair<value, value> :member
{ {
{ k, json::STRING }, string_view{} k, value{}
} }
{} {}

View file

@ -67,7 +67,7 @@ struct tuple
template<class U> explicit tuple(const tuple &, const json::keys<U> &); template<class U> explicit tuple(const tuple &, const json::keys<U> &);
tuple(const json::object &); tuple(const json::object &);
tuple(const json::iov &); tuple(const json::iov &);
tuple(const std::initializer_list<member> &); tuple(const json::members &);
tuple() = default; tuple() = default;
}; };
@ -200,7 +200,7 @@ tuple<T...>::tuple(const json::iov &iov)
} }
template<class... T> template<class... T>
tuple<T...>::tuple(const std::initializer_list<member> &members) tuple<T...>::tuple(const json::members &members)
{ {
std::for_each(std::begin(members), std::end(members), [this] std::for_each(std::begin(members), std::end(members), [this]
(const auto &member) (const auto &member)

View file

@ -21,7 +21,7 @@ namespace ircd::json
struct array; struct array;
struct vector; struct vector;
struct iov; struct iov;
using members = std::initializer_list<member>; using members = std::initializer_list<const member>;
enum type type(const string_view &); enum type type(const string_view &);
enum type type(const string_view &, std::nothrow_t); enum type type(const string_view &, std::nothrow_t);