Fixed clang-format violations

This commit is contained in:
Ivan-lis 2024-10-18 07:39:14 +00:00
parent 89f3165551
commit d9d301167c
2 changed files with 37 additions and 3 deletions

View file

@ -0,0 +1,34 @@
#pragma once
#include <cstddef>
#include <type_traits>
namespace larra::xmpp::impl {
template <typename T, std::size_t I = 0>
struct PublicCastTag {
friend constexpr auto MagicGetPrivateMember(PublicCastTag);
};
template <auto ptr, std::size_t I = 0>
struct PublicCast {};
template <typename T, typename R, R T::* ptr, std::size_t I>
struct PublicCast<ptr, I> {
friend constexpr auto MagicGetPrivateMember(PublicCastTag<T, I>) {
return ptr;
}
};
template <typename T, typename R, typename... Args, R (T::*ptr)(Args...), std::size_t I>
struct PublicCast<ptr, I> {
friend constexpr auto MagicGetPrivateMember(PublicCastTag<T, I>) {
return ptr;
}
};
template <typename T, std::size_t I = 0>
constexpr auto GetPrivateMember(const T&) {
return MagicGetPrivateMember(PublicCastTag<std::decay_t<T>, I>{});
};
} // namespace larra::xmpp::impl

View file

@ -83,9 +83,9 @@ struct FieldsDescription {
* \param value new value for field * \param value new value for field
* \return an object of type std::decay_t<Self> with data from T with fields from \ref self and the \ref value of the field \ref ptr * \return an object of type std::decay_t<Self> with data from T with fields from \ref self and the \ref value of the field \ref ptr
*/ */
template <typename Self, typename Value, typename Type> // NOLINTNEXTLINE template <typename Self, typename Value, typename Type>
constexpr auto With(Type(T::* ptr), Self&& self, Value&& value) const -> std::decay_t<Self> constexpr auto With(Type(T::* ptr), Self&& self, Value&& value) const
requires(std::is_constructible_v<T, impl::GetTypeT<Fs>...> && std::constructible_from<std::decay_t<Self>, T> && requires(std::is_constructible_v<T, impl::GetTypeT<Fs>...> && std::is_constructible_v<std::decay_t<Self>, T> &&
std::is_constructible_v<Type, decltype(value)> && impl::SetConcept<Self, Type, Fs...>) std::is_constructible_v<Type, decltype(value)> && impl::SetConcept<Self, Type, Fs...>)
{ {
return std::decay_t<Self>{utempl::Unpack(this->tuple, [&](auto... fs) -> T { return std::decay_t<Self>{utempl::Unpack(this->tuple, [&](auto... fs) -> T {