// 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_UNTIL_H namespace ircd { namespace json { template constexpr typename std::enable_if(), bool>::type until(const tuple &t, function&& f) noexcept { return true; } template constexpr typename std::enable_if(), bool>::type until(tuple &t, function&& f) noexcept { return true; } template inline typename std::enable_if(), bool>::type until(const tuple &t, function&& f) { return f(key(t), val(t))? until(t, std::forward(f)): false; } template inline typename std::enable_if(), bool>::type until(tuple &t, function&& f) { return f(key(t), val(t))? until(t, std::forward(f)): false; } template constexpr typename std::enable_if(), bool>::type until(const tuple &a, const tuple &b, function&& f) noexcept { return true; } template inline typename std::enable_if(), bool>::type until(const tuple &a, const tuple &b, function&& f) { return f(key(a), val(a), val(b))? until(a, b, std::forward(f)): false; } template constexpr typename std::enable_if<(i < 0), bool>::type runtil(const tuple &t, function&& f) noexcept { return true; } template constexpr typename std::enable_if<(i < 0), bool>::type runtil(tuple &t, function&& f) noexcept { return true; } template() - 1> inline typename std::enable_if(), bool>::type runtil(const tuple &t, function&& f) { return f(key(t), val(t))? runtil(t, std::forward(f)): false; } template() - 1> inline typename std::enable_if(), bool>::type runtil(tuple &t, function&& f) { return f(key(t), val(t))? runtil(t, std::forward(f)): false; } } // namespace json } // namespace ircd