-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add boost::variant
support
#430
Add boost::variant
support
#430
Conversation
1ebf4de
to
ca7c933
Compare
Is it possible to handle other variant types ? Like we did with the PR for optional types where we have a mechanism for both |
@ManifoldFR I will check if it's easy to handle std and boost with the same code |
std::variant are slow ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some spelling changes to do
/// bp::make_setter(&VariantHolder::variant)); | ||
/// } | ||
template <typename Variant> | ||
struct BoostVariantConvertor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a spelling mistake, it should be "Converter" as in the rest of the library. (not really a mistake because "Convertor" exists but it's very uncommon in English, users might get tripped up)
bp::class_<V1>("V1", bp::init<>()).def_readwrite("v", &V1::v); | ||
bp::class_<V2>("V2", bp::init<>()).def_readwrite("v", &V2::v); | ||
|
||
typedef eigenpy::BoostVariantConvertor<MyVariant> Convertor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also change the spelling in the typedef here to Converter
Upstream changelog: ## [3.4.0] - 2024-02-26 ### Added - Support for `Eigen::SparseMatrix` types (stack-of-tasks/eigenpy#426) - Support for `boost::variant` types with `VariantConverter` (stack-of-tasks/eigenpy#430) - Support for `std::variant` types with `VariantConverter` (stack-of-tasks/eigenpy#431) - Support for `std::unique_ptr` as a return types with `StdUniquePtrCallPolicies` and `boost::python::default_call_policies` (stack-of-tasks/eigenpy#433) - Support for `std::unique_ptr` as an internal reference with `ReturnInternalStdUniquePtr` (stack-of-tasks/eigenpy#433) - Support for `Eigen::Simplicial{LLT,LDLT}` and `Eigen::Cholmod{Simplicial,Supernodal}{LLT,LDLT}` Cholesky de compositions (stack-of-tasks/eigenpy#438) - Switch to ruff for lints, format, and import sort (stack-of-tasks/eigenpy#441) ### Fixed - Fix the issue of missing exposition of Eigen types with __int64 scalar type (stack-of-tasks/eigenpy#426) - Fix namespace use in unittest/std_pair.cpp (stack-of-tasks/eigenpy#429) - Fix case of zero-size sparse matrices (stack-of-tasks/eigenpy#437) Packaging changes: - remove patch-aa, fixed upstream
Upstream changelog: ## [3.4.0] - 2024-02-26 ### Added - Support for `Eigen::SparseMatrix` types (stack-of-tasks/eigenpy#426) - Support for `boost::variant` types with `VariantConverter` (stack-of-tasks/eigenpy#430) - Support for `std::variant` types with `VariantConverter` (stack-of-tasks/eigenpy#431) - Support for `std::unique_ptr` as a return types with `StdUniquePtrCallPolicies` and `boost::python::default_call_policies` (stack-of-tasks/eigenpy#433) - Support for `std::unique_ptr` as an internal reference with `ReturnInternalStdUniquePtr` (stack-of-tasks/eigenpy#433) - Support for `Eigen::Simplicial{LLT,LDLT}` and `Eigen::Cholmod{Simplicial,Supernodal}{LLT,LDLT}` Cholesky de compositions (stack-of-tasks/eigenpy#438) - Switch to ruff for lints, format, and import sort (stack-of-tasks/eigenpy#441) ### Fixed - Fix the issue of missing exposition of Eigen types with __int64 scalar type (stack-of-tasks/eigenpy#426) - Fix namespace use in unittest/std_pair.cpp (stack-of-tasks/eigenpy#429) - Fix case of zero-size sparse matrices (stack-of-tasks/eigenpy#437) Packaging changes: - remove patch-aa, fixed upstream
BoostVariantConverter
to register aboost::variant
conversion to an alternatives and alternatives conversion toboost::variant
.ReturnInternalBoostVariant
to return an alternative referenceAlso: