Comments (1)
Some of this may be impossible without either changing the call syntax or waiting until the library can support C++20.
There are a couple alternatives:
- Provide a slower solution for non-clang alternatives. This could likely be reduced to a single dereference per method invocation (the correct idx can still be inferred compile time).
- A syntax that explicitly requires providing the idx as a template argument based on a
constexpr
method invoked from the constexpr class. E.g.
LocalObject<kClass> obj {}.Call<kClass.idx("Foo">(...);
This introduces a lot of duplication and isn't visually appealing.
- Wait until C++ 20string literals are available and cut a library release that isn't backwards compatible.
Relevant links:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0424r2.pdf
http://je4d.s3.amazonaws.com/D0732R0-wip.pdf
https://artificial-mind.net/blog/2020/11/14/cpp17-consteval
Even still, this option may require a new syntax because operators can't be cleanly templated. E.g. you may need to write the syntax:
obj.template<"Foo">( ... );
Here at least we could offer a new syntax:
obj.Call<"Foo">( ... );
This would maintain dual compatibility but would be sad to introduce a new call syntax. It's unclear to me if consteval could provide a consistent syntax to what exists today.
- Look for a gcc equivalent of the function argument enable_if. This isn't particularly good long term either though.
What's unfortunate is that the correct idx can be inferred at compile time at the call site, but not once the member method has been invoked. C++17 has everything it needs.
I don't think this is trivial to resolve, so, I will leave this as an open problem, but not blocking for release. I tried every trick I had.
from jni-bind.
Related Issues (20)
- LocalString with null values in string originated from native are broken HOT 3
- Why jni-bind requires to specify default (parameterless) constructor if you specify your custom constructor? HOT 10
- Help to use inside XPLPC HOT 28
- Calling a method on a class for the first time on a secondary thread fails. HOT 6
- UTF-8 string conversion methods HOT 2
- Fix MSVC compilation failures HOT 1
- jni_mh.h with jint as 32-bit long HOT 9
- Add `Self` syntax documentation
- Attempt to remove non-JNI local reference with GlobalObject HOT 13
- Getting compilation errors when using modules HOT 3
- Generate release header is freezing on macOS HOT 3
- Godbolt Sample
- Introductory Youtube video
- Add cmake module file HOT 1
- Difficulty expressing a method call HOT 6
- Update Bazel to version 7.*
- Add Mac test runner HOT 2
- Add per trace logging
- Document `SetFallbackLoader` workaround for Android.
- `std::nullptr_t` should be an acceptable ctor for all `Scoped` types.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jni-bind.