diff --git a/include/ircd/json/tuple/key.h b/include/ircd/json/tuple/key.h index ca91b2035..9ab35252e 100644 --- a/include/ircd/json/tuple/key.h +++ b/include/ircd/json/tuple/key.h @@ -23,9 +23,18 @@ noexcept return tuple_element::key; } +template +inline enable_if_tuple +key(const tuple &t) +noexcept +{ + return std::get(t).key; +} + template -constexpr typename std::enable_if::type +inline typename std::enable_if::type key(const size_t &j) noexcept { @@ -34,22 +43,14 @@ noexcept template -constexpr typename std::enable_if::type +inline typename std::enable_if::type key(const size_t &j) noexcept { - return j == i? - tuple_element::key: - key(j); -} + if(likely(j != i)) + return key(j); -template -enable_if_tuple -key(const tuple &t) -noexcept -{ - return std::get(t).key; + return tuple_element::key; } } // namespace json diff --git a/include/ircd/json/tuple/tuple.h b/include/ircd/json/tuple/tuple.h index 7c0c6dbc2..344e7d475 100644 --- a/include/ircd/json/tuple/tuple.h +++ b/include/ircd/json/tuple/tuple.h @@ -167,7 +167,7 @@ noexcept } template -constexpr bool +inline bool key_exists(const string_view &key) { return indexof(key) < size();