-
Notifications
You must be signed in to change notification settings - Fork 169
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
Walking a template specialization #40
Comments
No, there is no way to do that. Why do you need it?
No, it's okay. |
I am using cppast to generate .net bindings for one project. Unfortunately some template containers are a big part of API and i am looking for ways to wrap these containers. I was considering to wrap every instantiation of template class as separate type with separate name so for example |
And you are looking for an automated way of generating such a |
Yes indeed i am. I already have wrapper generation automated for good chunk of API. these template classes are like a last piece of puzzle. |
Then I'm afraid there isn't an easy way to do it with the current API. |
But is there a "non-easy" way to do it ? trying to walk through a template instantiation, it seems that inner template arguments are unexposed and available as a string (for instance for I thought I could be able to retrieve arguments then get back to their types through the arguments array, but the template instantiation parsing code (in cppast::type_parser.cpp) seems to only provide unexposed_arguments ? |
I made a pull request (#99) that parses every template instantiation argument. There may be limitations, but up till now it worked for instantiations such as std::vector<std::shared_ptr,std::map<std::shared_ptrstd::string,std::vectorstd::string>> and provide the full AST. The template instantiation full argument parsing is built when the option-DCPPAST_TEMPLATE_FULLARGUMENTSPARSING=ON is used upon invoking cmake. |
Consider
std::vector<std::string>
used as return type somewhere. Is there a way to somehow use that return type and walk instantiation of classstd::vector<std::string>
so that methods ofstd::vector
havestd::string
type inserted where appropriate? Or do i have to resolve these template types manually somehow?P.S. I hope i am not getting annoying with spamming issue tracker with random questions. If there is a better place to ask these things please let me know.
P.P.S. Thank you for the help with other issues, i greatly appreciate swift response. Just never posted "thanks" messages to save you some spam in the mailbox :)
The text was updated successfully, but these errors were encountered: