// 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_INDEXOF_H namespace ircd { namespace json { template constexpr enable_if_tuple indexof() noexcept { if constexpr(i < size()) if constexpr(name_hash(key()) != hash) return indexof(); return i; } template constexpr enable_if_tuple indexof() noexcept { return indexof(); } template inline enable_if_tuple indexof(const char (&name)[N]) noexcept { if constexpr(i < size()) if(!_constexpr_equal(key(), name)) return indexof(name); return i; } template inline enable_if_tuple indexof(const string_view &name) noexcept { if constexpr(i < size()) { constexpr string_view key_name { key() }; if(!_constexpr_equal(name, key_name)) return indexof(name); } return i; } } // namespace json } // namespace ircd