bugenhancementhelp wanted
Repository metrics
- Stars
- (4,279 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
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?