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

feat: allow factories to deal with move-only constructor arguments #44

Merged

Conversation

andre-nguyen
Copy link
Contributor

@andre-nguyen andre-nguyen commented Feb 25, 2025

Resolves #43

Best explanation I've found about this is here.

@andre-nguyen andre-nguyen force-pushed the feat/move_only_arguments_factory branch from a16059e to 13e5078 Compare February 25, 2025 19:20
Copy link
Collaborator

@nathanhhughes nathanhhughes left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for fixing this! Definitely easy to forget about move-only types until you need them, so it's very appreciated you caught this 😄

(closes #43)

@andre-nguyen
Copy link
Contributor Author

Thank you for the quick review! Had to amend line 245 of factory.hpp because I forgot a &&

@andre-nguyen
Copy link
Contributor Author

Oh I forgot, I don't have merge rights, you'll have to do it for me 😇

@nathanhhughes nathanhhughes merged commit 4a35323 into MIT-SPARK:main Feb 25, 2025
2 checks passed
@Schmluk
Copy link
Collaborator

Schmluk commented Feb 25, 2025

Thanks for this fix @andre-nguyen and the quick reply @nathanhhughes, looks great!

andre-nguyen added a commit to andre-nguyen/config_utilities that referenced this pull request Feb 28, 2025
Schmluk pushed a commit that referenced this pull request Feb 28, 2025
* Revert "feat: allow factories to deal with move-only constructor arguments (#44)"

This reverts commit 4a35323.

* fix: support move-only parameter types in factories using std::move

The previous implementation using std::forward incorrectly used forwarding references. Given that the types are not deduced but actually explicitly written, '&&' is not actually a forwarding reference. Thus this commit replaces std::forward with std::move.
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.

Factories do not support move-only args
3 participants