-
Notifications
You must be signed in to change notification settings - Fork 1
Add tests and concepts for some functions #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why std::string as first parameter? Shouldn't that be ResultType?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here as I asked below (sorry) :-)
b6e6ba3 to
665a4b5
Compare
christianparpart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the delay :)
Some test and requires for provided functions