Fixed clang-format violations
This commit is contained in:
parent
89f3165551
commit
d9d301167c
2 changed files with 37 additions and 3 deletions
34
library/include/larra/impl/public_cast.hpp
Normal file
34
library/include/larra/impl/public_cast.hpp
Normal 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
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue