bytedeco / javacpp

The missing bridge between Java and native C++
Other
4.43k stars 576 forks source link

Optional pair #718

Closed HGuillemet closed 9 months ago

HGuillemet commented 9 months ago

The JNI of container classes generated by:

infoMap.put(new Info("std::pair<int,int>").pointerTypes("IntPair").define());
infoMap.put(new Info("std::optional<std::pair<int,int> >").pointerTypes("IntPairOptional").define());

does't compile, with errors like:

error: 'class std::optional<std::pair<int, int> >' has no member named 'first'
 1452 |     int rval = ptr->first;

The optional container passes the first and second function members of std::pair through, which can be practical, but there seems to be missing an indirection. The line above should be:

int rval = (*ptr)->first;
saudet commented 9 months ago

Fixed in commit 78f0203d3a8ce1b4f410ab52c1fd4bbda0e500d5

HGuillemet commented 9 months ago

Thanks.