-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use integers in template parameters due to private data members. #335
Comments
Thank you for your query. I must admit, I have never tried this exact kind of templatization. Please allow me to take a look at a few options regarding compatibility and get back to your query shortly. I would not immediately want to make the private data members public, but we might consider doing this with a new, specific compiler switch. Anyway, please allow me to investigate your query a bit. i'll get back with suggestions... Kind regards, Chris |
Proposed solution: #define WIDE_INTEGER_DISABLE_PRIVATE_CLASS_DATA_MEMBERS This optional macro can be used to disable Making private data members public is unusual for some designs so the default value is |
The repair is cycling in CI. Cc: @xamidi |
Thank you for the quick fix. I switched to the original file already, and all seems good. :) |
Great! Thank you @xamidi for raising this interesting issue. Glad it works. |
According to
README.md
:uintwide_t
should behave as closely as possible to the behaviors of signed and unsigned versions of built-inint
.So I tried to use
math::wide_integer::uint256_t
as a template parameter, but it failed with an errorFix:
This seems to be caused by the existence of non-public data members.
In
math/wide_integer/uintwide_t.h
I replaced allprivate:
bypublic:
, and now it works.Code example:
Apart from that, great work!
sizeof(UInt)
and-UInt(1)
wouldn't even work with the types of Boost.Multiprecision, andUInt(-1)
refused to beconstexpr
. All these things work fine withuintwide_t
.The text was updated successfully, but these errors were encountered: