-
Notifications
You must be signed in to change notification settings - Fork 3
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
Move/Copy Constructor #2
Comments
Could you elaborate on your use case, please? copying//moving static branch doesn't make much sense from underlying resources, it could be copied/moved but that would be misleading since static_branch has no state//fields etc. In principle it should be |
Now that you mention it, perhaps I'm misusing... My usecase is something like this, where I can have multiple distinct instances of
|
I see, your use case can ma accommodated, it might need to be done a bit differently as static_branch will be likely inlined per calculate instance and then hot patching will happen on top. I think I understand though, so please allow me to experiment a bit and I'll report back here how that can be approached. |
Okay, so there are 2 cases here to consider: if the compute call is going to be inlined a single |
How do copy and move constructors work with multiple instances of |
Yes, exactly - different instances per object. Not sure how that could work, after getting a better understanding of how the current impl works |
I wonder.... If the containing class has a default lambda template parameter, then each instantiation of of the object would yield a new type and therefore I think a different instantiation of the method definition? Would this be enough to accomplish this usecase?
|
That's a clever trick and could work. However, it comes with the restriction of not being able to have a container of these objects or store them in a class. We could use type erasure to address this, but comes at the cost of a virtual function dispatch. Do you agree or is there a better way of achieving the same? |
@kris-jusiak is there a better way of doing this? |
What would be required to enable the default move or copy constructors for
jmp::static_branch
? Asking because it's difficult to use these in an OOP context w/o at least one of these twoThe text was updated successfully, but these errors were encountered: