From d9d301167c43d4bd32ebfdf1dafa61958d26efe5 Mon Sep 17 00:00:00 2001 From: Ivan-lis Date: Fri, 18 Oct 2024 07:39:14 +0000 Subject: [PATCH] Fixed clang-format violations --- library/include/larra/impl/public_cast.hpp | 34 ++++++++++++++++++++++ library/include/larra/utils.hpp | 6 ++-- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 library/include/larra/impl/public_cast.hpp diff --git a/library/include/larra/impl/public_cast.hpp b/library/include/larra/impl/public_cast.hpp new file mode 100644 index 0000000..111909a --- /dev/null +++ b/library/include/larra/impl/public_cast.hpp @@ -0,0 +1,34 @@ +#pragma once +#include +#include + +namespace larra::xmpp::impl { + +template +struct PublicCastTag { + friend constexpr auto MagicGetPrivateMember(PublicCastTag); +}; + +template +struct PublicCast {}; + +template +struct PublicCast { + friend constexpr auto MagicGetPrivateMember(PublicCastTag) { + return ptr; + } +}; + +template +struct PublicCast { + friend constexpr auto MagicGetPrivateMember(PublicCastTag) { + return ptr; + } +}; + +template +constexpr auto GetPrivateMember(const T&) { + return MagicGetPrivateMember(PublicCastTag, I>{}); +}; + +} // namespace larra::xmpp::impl diff --git a/library/include/larra/utils.hpp b/library/include/larra/utils.hpp index bca4277..1141b7b 100644 --- a/library/include/larra/utils.hpp +++ b/library/include/larra/utils.hpp @@ -83,9 +83,9 @@ struct FieldsDescription { * \param value new value for field * \return an object of type std::decay_t with data from T with fields from \ref self and the \ref value of the field \ref ptr */ - template // NOLINTNEXTLINE - constexpr auto With(Type(T::* ptr), Self&& self, Value&& value) const -> std::decay_t - requires(std::is_constructible_v...> && std::constructible_from, T> && + template + constexpr auto With(Type(T::* ptr), Self&& self, Value&& value) const + requires(std::is_constructible_v...> && std::is_constructible_v, T> && std::is_constructible_v && impl::SetConcept) { return std::decay_t{utempl::Unpack(this->tuple, [&](auto... fs) -> T {