Replies: 1 comment
-
You can use The safer standard solution is to adopt either STL shared pointers or a custom intrusive reference counting-based approach. Again, both are extensively discussed in the documentation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my optimization modeling language, I expose some expression class to Python like
What I want is to construct a temporary constraint object when I write
expr<=1.0
and avoids copying theexpr
object while keeping memory safe.I assume that
Constraint
contains a pointer to theExpr
likeBut the code above seems not memory safe to store the raw pointer directly for the following Python code:
Is there some good solutions to this problem?
Beta Was this translation helpful? Give feedback.
All reactions