From 33b9ef346c701496becb69978dde80f8e4151846 Mon Sep 17 00:00:00 2001 From: stephenberry Date: Tue, 17 Sep 2024 23:27:50 +0000 Subject: [PATCH] Committing clang-format changes --- include/glaze/mustache/mustache.hpp | 42 ++++++++++++++------------- tests/mustache_test/mustache_test.cpp | 3 +- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/include/glaze/mustache/mustache.hpp b/include/glaze/mustache/mustache.hpp index a370381fe5..7db52756fe 100644 --- a/include/glaze/mustache/mustache.hpp +++ b/include/glaze/mustache/mustache.hpp @@ -46,13 +46,13 @@ namespace glz } sv key{s, size_t(it - s)}; - + static constexpr auto N = refl.N; static constexpr auto HashInfo = detail::hash_info; - + const auto index = detail::decode_hash::op(key.data(), key.data() + key.size()); - + if (index >= N) [[unlikely]] { ctx.error = error_code::unknown_key; return unexpected( @@ -60,29 +60,31 @@ namespace glz } else { static thread_local std::string temp{}; - detail::jump_table([&]() { - static constexpr auto TargetKey = get(refl.keys); - static constexpr auto Length = TargetKey.size(); - if (((s + Length) < end) && compare(TargetKey.data(), s)) [[likely]] { - if constexpr (detail::reflectable && N > 0) { - std::ignore = - write>(detail::get_member(value, get(detail::to_tuple(value))), temp, ctx); + detail::jump_table( + [&]() { + static constexpr auto TargetKey = get(refl.keys); + static constexpr auto Length = TargetKey.size(); + if (((s + Length) < end) && compare(TargetKey.data(), s)) [[likely]] { + if constexpr (detail::reflectable && N > 0) { + std::ignore = write>( + detail::get_member(value, get(detail::to_tuple(value))), temp, ctx); + } + else if constexpr (detail::glaze_object_t && N > 0) { + std::ignore = write>( + detail::get_member(value, get(refl.values)), temp, ctx); + } } - else if constexpr (detail::glaze_object_t && N > 0) { - std::ignore = - write>(detail::get_member(value, get(refl.values)), temp, ctx); + else { + ctx.error = error_code::unknown_key; } - } - else { - ctx.error = error_code::unknown_key; - } - }, index); - + }, + index); + if (bool(ctx.error)) [[unlikely]] { return unexpected( error_ctx{ctx.error, ctx.custom_error_message, size_t(it - start), ctx.includer_error}); } - + result.append(temp); } diff --git a/tests/mustache_test/mustache_test.cpp b/tests/mustache_test/mustache_test.cpp index fc921dab95..29a8203aae 100644 --- a/tests/mustache_test/mustache_test.cpp +++ b/tests/mustache_test/mustache_test.cpp @@ -3,8 +3,9 @@ #define UT_RUN_TIME_ONLY -#include "glaze/glaze.hpp" #include "glaze/mustache/mustache.hpp" + +#include "glaze/glaze.hpp" #include "glaze/mustache/stencilcount.hpp" #include "ut/ut.hpp"