r/cpp • WG21 Member • Aug 18 '26

P4444: std::big_int

https://isocpp.org/files/papers/D4444R0.html

Hey folks! Matt Borland, Christopher Kormanyos, and I are working on bringing infinite-precision integers to C++29. We now have a D4444R0 draft of a paper that should be in the next mailing.

We could really use some feedback so that the published R0 is as polished as possible. Any thoughts on the paper and on the reference implementation are greatly appreciated.

It would also be very helpful if you tested out whether our big_int implementation works for you. We're in need of some real deployment experience. If you're currently using Boost.Multiprecision, the library should be a drop-in replacement for cpp_int for the most part.

180 Upvotes

85 comments sorted by

View all comments

Show parent comment

1

u/tcanens Aug 20 '26

If you find some special combination like -(-x) just being x that expression templates could have simplified, you're stuck waiting 3 years until the next C++ version anyway. In the meantime, you'll just have to rewrite your code.

I don't see why. There's no need for the type to change; it only needs to simplify at the point of actual evaluation and that can be done under as-if.

1

u/eisenwave WG21 Member Aug 20 '26

It can be done as-if, but would you actually rely on that as a user? Personally I would not bother and always try to simplify my code by hand to avoid the uncertainty and possible implementation divergence.

Remember that when writing standard C++ code, you often have to assume that at least MSVC STL, libc++, and libstdc++ might be used as a standard library. If the simplification of -(-x)) isn't in the standard, you're basically rolling the dice on whether it happens.