diff --git a/include/ircd/json/tuple/key.h b/include/ircd/json/tuple/key.h new file mode 100644 index 000000000..7e0d463af --- /dev/null +++ b/include/ircd/json/tuple/key.h @@ -0,0 +1,52 @@ +// Matrix Construct +// +// Copyright (C) Matrix Construct Developers, Authors & Contributors +// Copyright (C) 2016-2018 Jason Volk +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice is present in all copies. The +// full license for this software is available in the LICENSE file. + +#pragma once +#define HAVE_IRCD_JSON_TUPLE_KEY_H + +namespace ircd { +namespace json { + +template +constexpr enable_if_tuple +key() +{ + return tuple_element::key; +} + +template +constexpr typename std::enable_if::type +key(const size_t &j) +{ + return nullptr; +} + +template +constexpr typename std::enable_if::type +key(const size_t &j) +{ + return j == i? + tuple_element::key: + key(j); +} + +template +enable_if_tuple +key(const tuple &t) +{ + return std::get(t).key; +} + +} // namespace json +} // namespace ircd diff --git a/include/ircd/json/tuple/tuple.h b/include/ircd/json/tuple/tuple.h index bb0eb72d7..f7d5cb29b 100644 --- a/include/ircd/json/tuple/tuple.h +++ b/include/ircd/json/tuple/tuple.h @@ -121,43 +121,10 @@ size() return tuple_size::value; } -template -constexpr enable_if_tuple -key() -{ - return tuple_element::key; -} - -template -constexpr typename std::enable_if::type -key(const size_t &j) -{ - return nullptr; -} - -template -constexpr typename std::enable_if::type -key(const size_t &j) -{ - return j == i? - tuple_element::key: - key(j); -} - -template -enable_if_tuple -key(const tuple &t) -{ - return std::get(t).key; -} - } // namespace json } // namespace ircd +#include "key.h" #include "indexof.h" namespace ircd {