Wednesday, August 13, 2003

JNI and the STL

While looking through some JNI code I started thinking more about IntArray and friends. To write a non-mutating STL-like jvector<T> wrapper for the underlying JNI calls would not be much work. A quick Google search did not turn up the code I hoped to find. Perhaps I should look for a std::vector<T> adaptor implementation and host it onto the JNI calls such as GetArrayLength. The easy thing to do would be to specialize jvector<> on each native type in Java. For example, JNI jint would use GetIntArrayElements. Seem simple enough?

No comments: