szaszm commented on code in PR #1659:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1659#discussion_r1329594537
##########
libminifi/include/utils/expected.h:
##########
@@ -31,28 +29,42 @@ inline constexpr bool is_expected_v = false;
template<typename V, typename E>
inline constexpr bool is_expected_v<nonstd::expected<V, E>> = true;
-// map implementation
-template<typename Expected, typename F, typename =
std::enable_if_t<is_expected_v<utils::remove_cvref_t<Expected>>>>
-auto operator|(Expected&& object, map_wrapper<F> f) {
- using value_type = typename utils::remove_cvref_t<Expected>::value_type;
- using error_type = typename utils::remove_cvref_t<Expected>::error_type;
- if constexpr (std::is_same_v<value_type, void>) {
- using function_return_type =
std::decay_t<decltype(std::invoke(std::forward<F>(f.function)))>;
+template<typename T>
+concept expected = is_expected_v<std::remove_cvref_t<T>>;
+
+template<typename T>
+inline constexpr bool is_valid_unexpected_type_v = std::is_same_v<T,
std::remove_cvref_t<T>> && std::is_object_v<T> && !std::is_array_v<T>;
+
+template<typename T>
+inline constexpr bool is_valid_unexpected_type_v<nonstd::unexpected_type<T>> =
false;
Review Comment:
I can rename it, but I don't understand the problem: it's a generic name
used for type parameters when communicating more context isn't necessary. Is it
really confusing to have identically named `typename T` in a partial template
specialization and a related concept definition?
Would it be better to use separate names for all of them (let's say `T`, `U`
and `V`), or some other arrangement (like `T` for the first one, `E` for the
partial specialization, `F` for the concept)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]