Skip to content
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

[Dynamic Selection] Customization - Design approach for free function that calls member if available or default other #1023

Merged
merged 11 commits into from
Aug 9, 2023

Conversation

AnuyaWelling2801
Copy link
Contributor

  1. Added default free functions for invoke, invoke with a handle and invoke async
  2. Implemented customizations for invoke, invoke with a handle and invoke async, so that if a policy implemented any of these functions it would be redirected to the policy's member function.
  3. Removed the policy wrapper.

@AnuyaWelling2801 AnuyaWelling2801 changed the title Design approach for free function that calls member if available or default other [Dynamic Selection] Design approach for free function that calls member if available or default other Jul 21, 2023
@AnuyaWelling2801 AnuyaWelling2801 marked this pull request as draft July 27, 2023 18:18
Copy link
Contributor

@vossmjp vossmjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly ok, except for some forwarding that needs to be checked.

auto report(const Property &prop, const Value &value) const {
return const_cast<const scoring_policy_t &>(*scoring_policy_).report(prop, value);
else {
return invoke_async(std::forward<DSPolicy>(dp), std::forward<DSPolicy>(dp).select(std::forward<Function>(f), std::forward<Args>(args)...), std::forward<Function>(f), std::forward<Args>(args)...);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are forwarding both f and args twice in the same function. Might be ok, but you should be sure they can never be moved in a call to select.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

auto get_wait_list(){
return scoring_policy_->get_wait_list();
else{
return wait(std::forward<DSPolicy>(dp).invoke_async(std::forward<DSPolicy>(dp).select(std::forward<Function>(f), std::forward<Args>(args)...), std::forward<Function>(f), std::forward<Args>(args)...));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same possible issue with double forwarding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@AnuyaWelling2801 AnuyaWelling2801 changed the title [Dynamic Selection] Design approach for free function that calls member if available or default other [Dynamic Selection] Customization - Design approach for free function that calls member if available or default other Aug 2, 2023
@AnuyaWelling2801 AnuyaWelling2801 marked this pull request as ready for review August 7, 2023 13:51
Copy link
Contributor

@vossmjp vossmjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks go to me

@AnuyaWelling2801 AnuyaWelling2801 merged commit 186a641 into dynamic_selection Aug 9, 2023
@AnuyaWelling2801 AnuyaWelling2801 deleted the dev/awelling/customization branch August 9, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants