"ScL Feature"
/
ScL Feature
0.0.1
C++20 composable proxy wrapper with pluggable executor strategy
Toggle main menu visibility
Loading...
Searching...
No Matches
property.h
Go to the documentation of this file.
1
#pragma once
2
74
75
#include <scl/feature/detail/property_execution.h>
76
#include <
scl/feature/reflection/type.h
>
77
#include <
scl/feature/type_traits/executor.h
>
78
#include <scl/feature/wrapper.h>
79
80
#include <type_traits>
81
#include <utility>
82
83
// clang-format off
84
89
#define SCL_EXECUTOR_VALUE_TYPE \
90
::std::remove_reference_t<decltype(s_c_l_executor_type::access(::std::declval<s_c_l_executor_type &>()))>
91
112
#define SCL_REFLECT_PROPERTY_EXEC_HELPERS(prop) \
113
struct property_##prop##_scl_tag \
114
{ \
115
template <typename ScLExec> \
116
static constexpr bool has_override = \
117
requires { \
118
static_cast< \
119
decltype(::std::remove_cvref_t<ScLExec>::property_##prop( \
120
::std::declval<ScLExec>())) \
121
(*)(ScLExec) \
122
>(&::std::remove_cvref_t<ScLExec>::property_##prop); \
123
}; \
124
template <typename ScLExec> \
125
static constexpr bool override_noexcept = \
126
[]() constexpr noexcept -> bool { \
127
if constexpr (has_override<ScLExec>) \
128
return noexcept(::std::remove_cvref_t<ScLExec>::property_##prop( \
129
::std::declval<ScLExec>())); \
130
return false; \
131
}(); \
132
template <typename ScLExec> \
133
static auto call_override(ScLExec && exec) \
134
-> decltype(::std::remove_cvref_t<ScLExec>::property_##prop( \
135
::std::forward<ScLExec>(exec))) \
136
{ \
137
return ::std::remove_cvref_t<ScLExec>::property_##prop( \
138
::std::forward<ScLExec>(exec)); \
139
} \
140
};
141
151
#define SCL_DECLTYPE_PROPERTY(prop) \
152
::scl::wrapper< \
153
::std::remove_reference_t<decltype(::std::declval<SCL_EXECUTOR_VALUE_TYPE>().prop)>, \
154
::scl::feature::detail::property_execution<s_c_l_executor_type, \
155
property_##prop##_scl_tag>::template holder \
156
>
157
195
#define SCL_REFLECT_PROPERTY(prop) \
196
SCL_REFLECT_PROPERTY_EXEC_HELPERS(prop) \
197
SCL_DECLTYPE_PROPERTY(prop) \
198
prop{&::scl::feature::executor_trait<s_c_l_type>::executor( \
199
*static_cast<s_c_l_type *>(this)), \
200
&SCL_EXECUTOR_VALUE_TYPE::prop};
201
202
// clang-format on
type.h
Macro for declaring the wrapper type used by reflection macros.
executor.h
Executor type traits: interface detection and noexcept helpers.
src
scl
feature
reflection
property.h
Generated by
1.18.0