- Did you try to use the library? With what compiler? Did you have any problems?
I did but as we use a pattern like this in our code:
enum class big_quantity : int128_type { none = std::numeric_limits<int128_type>::max() };
which of course doesn't work with this type so it was not useful. However I could potentially create a derived class that has the same benefit possibly (I want a named integer type) but then I'd have to rewire a bunch of other stuff. I did enough to see that we could potentially have this work but it was too much effort for this review.
I have not tried this, but for whatever it's worth Claude (Opus 5 Max) recommends the following: Works everywhere including MSVC and SYCL device: struct big_quantity { boost::int128::int128 value {}; static const big_quantity none; }; constexpr big_quantity big_quantity::none {std::numeric_limits<boost::int128::int128>::max()}; Verified usable in constant expressions. You supply operator==/operator!= yourself pre-C++20. What you lose versus enum class is switch exhaustiveness and implicit-conversion blocking.
We use __int128 in our codebase for exactly the reasons listed in the rationale but sadly this would not be a trivial drop-in replacement but I could see how it might be useful if we needed it. We do need an int256 type that's lightweight and performant and if we had that I could see us using this as well as for that it would be worth working out the (extensive) reworking of the enum pattern.
That said I think this library is a valuable addition (but int256 would be even more useful ;-)) so I vote to ACCEPT the library. Jamie
int256 has come up a number of times during this review period so I will probably work on that over the next few months. Shouldn't be a large leap from what is already in here. Thank you for taking the time to review! Matt