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

How to wrap templated C++ class with Cxx #479

Open
TomasOberhuber opened this issue Jul 28, 2020 · 2 comments
Open

How to wrap templated C++ class with Cxx #479

TomasOberhuber opened this issue Jul 28, 2020 · 2 comments

Comments

@TomasOberhuber
Copy link

Hi again,

I am trying to export interface of C++ templated library to Julia using Cxx and I cannot find a good way how to do it. Suppose I have a class like this:

template< typename T >
struct myArray
{
   myArray() {...};
  
   myArray( int size ) {...};

  void setSize( int size ) {...};

   int getSize() {...};
};

I would like to use Cxx in Julia to define struct, constructor with size and functions getSize and setSize. And another question, how could I deal with type T? How to pass it from Julia to myArray?

Thanks for ant help, Tomas.

@Gnimuc
Copy link
Member

Gnimuc commented Jul 29, 2020

You might be interested in this example:

const StdVector{T} = Union{cxxt"std::vector<$T>",cxxt"std::vector<$T>&"}

@TomasOberhuber
Copy link
Author

Perfect, it looks great. Thanks a lot.

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

No branches or pull requests

2 participants