Hello,
Is it possible to define such a type that :
type
RawA {.importcpp: "A".} = object
A[T] = distinct RawA
The issue with this is that the type A will generate C++ templated code :A::A<T> and that will not compile since A (in C++) is not templated.
Is it possible to have a generic Nim type that does not generate a C++ template code ?
I've also thought of using an aggregation pattern :
type
A[T] := object
raw : RawA
But it complexify things and I would like to avoid it if possible. For context, this happens during wrapping Tensor type of Torch library.
torch::tensor type is not templated but the Tensor holds scalars of a given type.
Therefore there is a non generic type RawTensor {.importcpp: "Tensor".} that map directly.
The goal is to create a more idiomatic Nim API with a generic type Tensor that can be converted to RawTensor.
The idea was to do Tensor[T] = distinct RawTensor `` but this generate C++ code ``torch::tensor<T>.
hence, the question if it's possible to achieve such a thing