Skip to content

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

Open
@jorisv

Description

@jorisv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions