replaced raw void* with std::any#1149
Draft
orange-cpp wants to merge 2 commits intoCrowCpp:masterfrom
Draft
Conversation
Author
|
Fixed missing |
gittiver
reviewed
Mar 5, 2026
Member
gittiver
left a comment
There was a problem hiding this comment.
any has value characteristics, so there should be at least test to check if it behaves correctly?
Author
Tested it in my pet projects works very nicely, with smart pointers and any other types. Should be good to merge |
Member
|
set back to drift as no documentation and no tests were provided. |
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.
Updates the way user data is managed in the
crow::websocket::connectionclass, replacing the use of raw pointers with a safer and more flexible and memory safe approach.Improvements to user data handling:
userdata_member from avoid*to astd::any, allowing storage of arbitrary types and improving type safety.userdata()setter and getter methods to usestd::anyinstead ofvoid*, enabling safer and more flexible user data management.Why it's important:
Output:
You see client code can have huge .onclose handler and you can forgot call delete on object wich leads to memory leak or you can miss-cast type into something else and get UB wich is even worse.