From cea114d41ddb6a9c649c66c69088413c5046785b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 12 Dec 2017 13:23:20 -0700 Subject: [PATCH] ircd::json: Use the defined() rather than default ctor / cleanup. --- include/ircd/json/tuple.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/ircd/json/tuple.h b/include/ircd/json/tuple.h index d82cb3b64..84cd3f966 100644 --- a/include/ircd/json/tuple.h +++ b/include/ircd/json/tuple.h @@ -64,11 +64,11 @@ struct tuple using tuple_type = std::tuple; using super_type = tuple; + static constexpr size_t size(); + operator json::value() const; operator crh::sha256::buf() const; - static constexpr size_t size(); - template tuple(const tuple &); tuple(const json::object &); tuple(const json::iov &); @@ -411,7 +411,7 @@ get(const tuple &t, using value_type = tuple_value_type; //TODO: undefined - return ret != value_type{}? ret : def; + return defined(ret)? ret : def; } template(t)}; using value_type = decltype(ret); - return ret != value_type{}? ret : def; + return defined(ret)? ret : def; } template; - //TODO: undefined - if(ret == value_type{}) + //TODO: XXX + if(!defined(ret)) throw not_found("%s", key(t)); return ret; @@ -480,8 +480,8 @@ at(tuple &t) using value_type = tuple_value_type; - //TODO: undefined - if(ret == value_type{}) + //TODO: XXX + if(!defined(ret)) throw not_found("%s", key(t)); return ret; @@ -505,7 +505,7 @@ at(const tuple &t) using value_type = tuple_value_type; //TODO: undefined - if(ret == value_type{}) + if(!defined(ret)) throw not_found("%s", name); return ret; @@ -529,7 +529,7 @@ at(tuple &t) using value_type = tuple_value_type; //TODO: undefined - if(ret == value_type{}) + if(!defined(ret)) throw not_found("%s", name); return ret;