This repository was archived by the owner on Sep 26, 2025. It is now read-only.
[API breaking] Use polymorphic value type holder for manifolds and constraint sets#90
Merged
ManifoldFR merged 93 commits intodevelfrom Sep 12, 2024
Merged
Conversation
6f83d1c to
4f007fc
Compare
4d33d96 to
d026846
Compare
Member
Author
|
The last thing to do before merging, which is very relevant for downstream integration into aligator, is being able to extend interfaces from Python. Right now, inheriting from
|
031b3fa to
2141f6a
Compare
fe0d337 to
94830ff
Compare
edantec
reviewed
Jun 6, 2024
Member
Author
jorisv
suggested changes
Jun 7, 2024
Member
Author
|
While discussing with @jorisv, we found that:
|
a6ef49c to
3308bfa
Compare
+ also remove anon-namespaced typedef PolymorphicManifold
…g-v2-rebased Topic/polymorphic binding v2 rebased
…orward ctor arguments
remove PointType and TangentVectorType typedefs (they're always dynamic sized arrays)
5231f3d to
80601a0
Compare
jorisv
approved these changes
Sep 12, 2024
Member
Author
|
Okay, we will be merging this today. This is not the perfect solution imo, I'd be willing to look at other types of type erasure in the future for the definitive API (and rip out the OOP class hierarchies here and in aligator, downstream). |
2 tasks
ManifoldFR
added a commit
that referenced
this pull request
Sep 16, 2024
…c-value [API breaking] Use polymorphic value type holder for manifolds and constraint sets
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:
shared_ptrfor manifold and constraint set types, switching to jbcoe/value_types'spolymorphictemplate class everywhere as a holder with value semanticsstd::make_shared<T>(...)all the time, see changed C++ examplesproxsuite-nlp/python/polymorphic.hppfor dealing with values/references ofpolymorphic<T>, register conversions, etcPolymorphicVisitorto the Python bindings which registers a typeYas convertible to the template argumentpolymorphic<X>constraints.txx: closes Template instantiation: split upconstraints.hppandconstraints.txxmega-headers #87Known issues
polymorphic<X>by value does not check whether the underlying object is aboost::python::wrapper<U>for some typeUwhich inherits fromXBackground
This is the first in a series of PR which will cut down on our overuse of
shared_ptracross both proxsuite-nlp and aligator and replace it with a holder for polymorphic objects with value semantics.The drawbacks to the current approach with
shared_ptrwas:shared_ptr<T>, except if we add virtual clone member functions implemented in all derived classesBoxConstraint)The polymorphic value type was described by Jonathan Coe: https://www.youtube.com/watch?v=sjLRX4WMvlU. It allows composite classes (with polymorphic data members) to behave well using value-semantics all the way down (with const-correctness).
Why not unique_ptr ?
unique_ptr completely removes any ability to copy the underlying object (except if a virtual
clone()was implemented) and disables default copy ctor/operators for all composite classes using it.Many thanks to @edantec for his contribution.