Our cpp code looks like this
enum Types { FLOAT = 1, DOUBLE = 2, ... } template <Types T, typename = typename std::enable_if<T == FLOAT>::type> int search(const float *vec, size_t dim) { ... } template <Types T, typename = typename std::enable_if<T == DOUBLE>::type> int search(const double *vec, size_t dim) { ... }
infoMap.put(new Info("Someclass::search<FLOAT>").javaNames("search"));
Javacpp will instantiate all the search functions instead of only the FLOAT
one. (Subtle to us as we need all the functions.) The bigger problem is generated JNI code will call the function without template argument, leading to compiling error.
int rval = ptr->search((const float*)ptr0, (size_t)arg1);
Relevant compiling message
candidate template ignored: couldn't infer template argument 'T'
int search(const float *vec, size_t dim);
How to help JavaCPP generating the right calling code?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4