Unable to use gnu mpz types for NumberIntegerType
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 50.6k
- Forks
- 7.5k
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 58
Description
Description
I was hoping it would be possible to set NumberIntegerType and NumberUnsignedType (putting aside #2573 for now) to an arbitrary precision integer type ("big integers"), such as on wrapper types around the gnu multiple precision arithmetic library.
Unfortunately, this is not permitted as json_value is a C-style tagged union that doesn't permit any of its types to have non-trivial destructors/move constructors etc; and mpz is stored on the heap.
I understand this is quite a big ask, but I thought it was worth having an issue explicitly mentioning big integers since I wasn't able to find an existing one via search.
Reproduction steps
Attempt to use some numeric heap type for the numeric type parameters. I'm afraid I don't have a trivial example to hand without external dependencies.
Expected vs. actual results
In an ideal world, I would expect everthing to just work. Instead, I get compiler errors about deleted operators on json_value due to it being a union of non trivial types.
Minimal code example
No response
Error messages
No response
Compiler and operating system
N/A
Library version
d4daaa897f48bf7bb2f96b46b84e49f32dd11daf
Validation
- The bug also occurs if the latest version from the
developbranch is used. - I can successfully compile and run the unit tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the json_value implementation and the NumberIntegerType and NumberUnsignedType definitions, then inspect the existing unit tests for numeric type behavior. Reproduce the deleted-operator compiler errors with a wrapper around GNU MPZ. Done means arbitrary-precision integer types can be used without violating json_value's type constraints and the relevant tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100