Add tests and concepts for some functions#13
Conversation
| /// | ||
| /// @return The result of the fold | ||
| template <typename Object, typename Callable, typename ResultType> | ||
| requires std::same_as<ResultType, std::invoke_result_t<Callable, std::string, MemberTypeOf<1, Object>, ResultType>> |
There was a problem hiding this comment.
why std::string as first parameter? Shouldn't that be ResultType?
There was a problem hiding this comment.
callable is called in the following way:
result = callable(MemberNameOf<I, Object>, value, result);
so it must take MemberNameOf<I, Object> (std::string) as first argument and return result type which is ResultType
In the requires statement we first check that we can invoke callable with the required arguments
std::invoke_result_t<Callable, std::string, MemberTypeOf<1, Object>, ResultType>
and then check that returned type is ResultType in std::same_as<ResultType, std::invoke_result_t<>>
| } | ||
|
|
||
| template <typename Object, typename Callable> | ||
| requires std::same_as<void, std::invoke_result_t<Callable, std::string, MemberTypeOf<1, Object>>> |
There was a problem hiding this comment.
same question here as I asked below (sorry) :-)
b6e6ba3 to
665a4b5
Compare
christianparpart
left a comment
There was a problem hiding this comment.
sorry for the delay :)
Some test and requires for provided functions