Skip to content
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

Find a way to use different explicit template instantiation C++ library in the same program #2257

Open
jorisv opened this issue May 29, 2024 · 0 comments
Labels

Comments

@jorisv
Copy link
Contributor

jorisv commented May 29, 2024

Explicit template instantiation C++ library use a context file that define the custom scalar to be used.

This custom scalar is a globally defined, and then, it's impossible to have the explicit template instantiation defined for two custom scalar type in the same C++ file.

By example the following code will be able to use explicit template instantiation for double but not for cppad:

#include "pinocchio/autodiff/cppad.hpp"
#include "pinocchio/multibody/model.hpp"
#include "pinocchio/multibody/data.hpp"
#include "pinocchio/multibody/sample-models.hpp"

typedef pinocchio::ModelTpl<CppAD::AD<double>> ADModel;
typedef pinocchio::DataTpl<CppAD::AD<double>> ADData;

int main()
{
  pinocchio::Model model;
  pinocchio::buildModels::manipulator(model);
  pinocchio::Data data(model);

  ADModel ad_model = model.cast<CppAD::AD<double>>();
  ADData ad_data(ad_model);
}

We should find another way to declare explicit template instantiation that allow to declare it to multiple scalar type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

1 participant