|
@@ -164,12 +164,12 @@ using meta_function_helper_t = typename meta_function_helper<Type, Candidate>::t
|
|
|
* @param value Value to wrap.
|
|
* @param value Value to wrap.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Policy = as_is_t, typename Type>
|
|
|
|
|
|
|
+template<typename Policy = as_value_t, typename Type>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_dispatch(const meta_ctx &ctx, [[maybe_unused]] Type &&value) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_dispatch(const meta_ctx &ctx, [[maybe_unused]] Type &&value) {
|
|
|
if constexpr(std::is_same_v<Policy, as_cref_t>) {
|
|
if constexpr(std::is_same_v<Policy, as_cref_t>) {
|
|
|
static_assert(std::is_lvalue_reference_v<Type>, "Invalid type");
|
|
static_assert(std::is_lvalue_reference_v<Type>, "Invalid type");
|
|
|
return meta_any{ctx, std::in_place_type<const std::remove_reference_t<Type> &>, std::as_const(value)};
|
|
return meta_any{ctx, std::in_place_type<const std::remove_reference_t<Type> &>, std::as_const(value)};
|
|
|
- } else if constexpr(std::is_same_v<Policy, as_ref_t> || (std::is_same_v<Policy, as_auto_t> && std::is_lvalue_reference_v<Type>)) {
|
|
|
|
|
|
|
+ } else if constexpr(std::is_same_v<Policy, as_ref_t> || (std::is_same_v<Policy, as_is_t> && std::is_lvalue_reference_v<Type>)) {
|
|
|
return meta_any{ctx, std::in_place_type<Type>, value};
|
|
return meta_any{ctx, std::in_place_type<Type>, value};
|
|
|
} else if constexpr(std::is_same_v<Policy, as_void_t>) {
|
|
} else if constexpr(std::is_same_v<Policy, as_void_t>) {
|
|
|
return meta_any{ctx, std::in_place_type<void>};
|
|
return meta_any{ctx, std::in_place_type<void>};
|
|
@@ -185,7 +185,7 @@ template<typename Policy = as_is_t, typename Type>
|
|
|
* @param value Value to wrap.
|
|
* @param value Value to wrap.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Policy = as_is_t, typename Type>
|
|
|
|
|
|
|
+template<typename Policy = as_value_t, typename Type>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_dispatch(Type &&value) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_dispatch(Type &&value) {
|
|
|
return meta_dispatch<Policy, Type>(locator<meta_ctx>::value_or(), std::forward<Type>(value));
|
|
return meta_dispatch<Policy, Type>(locator<meta_ctx>::value_or(), std::forward<Type>(value));
|
|
|
}
|
|
}
|
|
@@ -313,7 +313,7 @@ template<typename Type, auto Data>
|
|
|
* @param instance An opaque instance of the underlying type, if required.
|
|
* @param instance An opaque instance of the underlying type, if required.
|
|
|
* @return A meta any containing the value of the underlying variable.
|
|
* @return A meta any containing the value of the underlying variable.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, auto Data, typename Policy = as_is_t>
|
|
|
|
|
|
|
+template<typename Type, auto Data, typename Policy = as_value_t>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_getter(meta_handle instance) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_getter(meta_handle instance) {
|
|
|
if constexpr(std::is_member_pointer_v<decltype(Data)> || std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Data)>>>) {
|
|
if constexpr(std::is_member_pointer_v<decltype(Data)> || std::is_function_v<std::remove_reference_t<std::remove_pointer_t<decltype(Data)>>>) {
|
|
|
if constexpr(!std::is_array_v<std::remove_const_t<std::remove_reference_t<std::invoke_result_t<decltype(Data), Type &>>>>) {
|
|
if constexpr(!std::is_array_v<std::remove_const_t<std::remove_reference_t<std::invoke_result_t<decltype(Data), Type &>>>>) {
|
|
@@ -352,7 +352,7 @@ template<typename Type, auto Data, typename Policy = as_is_t>
|
|
|
* @param args Parameters to use to _invoke_ the object.
|
|
* @param args Parameters to use to _invoke_ the object.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, typename Policy = as_is_t, typename Candidate>
|
|
|
|
|
|
|
+template<typename Type, typename Policy = as_value_t, typename Candidate>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_invoke(meta_handle instance, Candidate &&candidate, meta_any *const args) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_invoke(meta_handle instance, Candidate &&candidate, meta_any *const args) {
|
|
|
return internal::meta_invoke<Type, Policy>(*instance.operator->(), std::forward<Candidate>(candidate), args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<Candidate>>::args_type::size>{});
|
|
return internal::meta_invoke<Type, Policy>(*instance.operator->(), std::forward<Candidate>(candidate), args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<Candidate>>::args_type::size>{});
|
|
|
}
|
|
}
|
|
@@ -366,7 +366,7 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
|
|
|
* @param args Parameters to use to invoke the function.
|
|
* @param args Parameters to use to invoke the function.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, auto Candidate, typename Policy = as_is_t>
|
|
|
|
|
|
|
+template<typename Type, auto Candidate, typename Policy = as_value_t>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_invoke(meta_handle instance, meta_any *const args) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_invoke(meta_handle instance, meta_any *const args) {
|
|
|
return internal::meta_invoke<Type, Policy>(*instance.operator->(), Candidate, args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<decltype(Candidate)>>::args_type::size>{});
|
|
return internal::meta_invoke<Type, Policy>(*instance.operator->(), Candidate, args, std::make_index_sequence<meta_function_helper_t<Type, std::remove_reference_t<decltype(Candidate)>>::args_type::size>{});
|
|
|
}
|
|
}
|
|
@@ -416,7 +416,7 @@ template<typename Type, typename... Args>
|
|
|
* @param args Parameters to use to _invoke_ the object.
|
|
* @param args Parameters to use to _invoke_ the object.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, typename Policy = as_is_t, typename Candidate>
|
|
|
|
|
|
|
+template<typename Type, typename Policy = as_value_t, typename Candidate>
|
|
|
[[nodiscard]] meta_any meta_construct(const meta_ctx &ctx, Candidate &&candidate, meta_any *const args) {
|
|
[[nodiscard]] meta_any meta_construct(const meta_ctx &ctx, Candidate &&candidate, meta_any *const args) {
|
|
|
if constexpr(meta_function_helper_t<Type, Candidate>::is_static || std::is_class_v<std::remove_const_t<std::remove_reference_t<Candidate>>>) {
|
|
if constexpr(meta_function_helper_t<Type, Candidate>::is_static || std::is_class_v<std::remove_const_t<std::remove_reference_t<Candidate>>>) {
|
|
|
meta_any placeholder{meta_ctx_arg, ctx};
|
|
meta_any placeholder{meta_ctx_arg, ctx};
|
|
@@ -436,7 +436,7 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
|
|
|
* @param args Parameters to use to _invoke_ the object.
|
|
* @param args Parameters to use to _invoke_ the object.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, typename Policy = as_is_t, typename Candidate>
|
|
|
|
|
|
|
+template<typename Type, typename Policy = as_value_t, typename Candidate>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_construct(Candidate &&candidate, meta_any *const args) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_construct(Candidate &&candidate, meta_any *const args) {
|
|
|
return meta_construct<Type, Policy>(locator<meta_ctx>::value_or(), std::forward<Candidate>(candidate), args);
|
|
return meta_construct<Type, Policy>(locator<meta_ctx>::value_or(), std::forward<Candidate>(candidate), args);
|
|
|
}
|
|
}
|
|
@@ -455,7 +455,7 @@ template<typename Type, typename Policy = as_is_t, typename Candidate>
|
|
|
* @param args Parameters to use to invoke the function.
|
|
* @param args Parameters to use to invoke the function.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, auto Candidate, typename Policy = as_is_t>
|
|
|
|
|
|
|
+template<typename Type, auto Candidate, typename Policy = as_value_t>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_construct(const meta_ctx &ctx, meta_any *const args) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_construct(const meta_ctx &ctx, meta_any *const args) {
|
|
|
return meta_construct<Type, Policy>(ctx, Candidate, args);
|
|
return meta_construct<Type, Policy>(ctx, Candidate, args);
|
|
|
}
|
|
}
|
|
@@ -468,7 +468,7 @@ template<typename Type, auto Candidate, typename Policy = as_is_t>
|
|
|
* @param args Parameters to use to invoke the function.
|
|
* @param args Parameters to use to invoke the function.
|
|
|
* @return A meta any containing the returned value, if any.
|
|
* @return A meta any containing the returned value, if any.
|
|
|
*/
|
|
*/
|
|
|
-template<typename Type, auto Candidate, typename Policy = as_is_t>
|
|
|
|
|
|
|
+template<typename Type, auto Candidate, typename Policy = as_value_t>
|
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_construct(meta_any *const args) {
|
|
[[nodiscard]] std::enable_if_t<is_meta_policy_v<Policy>, meta_any> meta_construct(meta_any *const args) {
|
|
|
return meta_construct<Type, Candidate, Policy>(locator<meta_ctx>::value_or(), args);
|
|
return meta_construct<Type, Candidate, Policy>(locator<meta_ctx>::value_or(), args);
|
|
|
}
|
|
}
|