Added emplace variants of enqueue and try_enqueue#275
Open
gameraccoon wants to merge 3 commits intocameron314:masterfrom
Open
Added emplace variants of enqueue and try_enqueue#275gameraccoon wants to merge 3 commits intocameron314:masterfrom
gameraccoon wants to merge 3 commits intocameron314:masterfrom
Conversation
…he type from 'U' to 'Args' for internal methods to denote that these are constructor arguments
netborg-afps
added a commit
to netborg-afps/dxvk-low-latency
that referenced
this pull request
Jul 27, 2023
netborg-afps
added a commit
to netborg-afps/dxvk-low-latency
that referenced
this pull request
Sep 21, 2023
netborg-afps
added a commit
to netborg-afps/dxvk-low-latency
that referenced
this pull request
Nov 2, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds variants of
enqueueandtry_enqueuethat construct queue elements in-place. This allows avoiding an extra move for potentially expensive to move objects.The next functions were added:
enqueue_emplace- a variant of enqueue that takes constructor arguments of an element to construct the element in-place in the queue.enqueue_token_emplace- a variant of enqueue that takes producer_token_t and constructor arguments to construct the element in-place in the queue (nameenqueue_emplacecould not be used because of collision with the previous variadic template function when using multiple arguments)try_enqueue_emplace- a variant oftry_enqueuethat takes constructor arguments (same as above)try_enqueue_token_emplace- a variant oftry_enqueuethat takes producer_token_t and constructor arguments (same as above)Added simple unit tests to cover new functions.
The PR split into two commits: the change+tests, and refactoring to variable names.
I'm not sure whether it's a good contribution or not because it makes the code of the implementation a bit more complex, but it feels like a nice option to have for the users. Also not sure whether the chosen names fit nicely with the codebase.
Feel free to make any changes.