Skip to content
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

Add constexpr support for dynamic allocated cpp_int #654

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

marcoffee
Copy link

@marcoffee marcoffee commented Feb 13, 2025

Added constexpr support for dynamic allocated cpp_ints as long as compiler implements features __cpp_constexpr_dynamic_alloc and __cpp_lib_constexpr_dynamic_alloc from P0784R7.

If those features are disabled, it behaves as the current implementation. Note that those features require C++20, so they will only work when passing -std=c++2a (or beyond) flag during compilation through a supported compiler (tested here on g++-11+ and clang++-16+ using libstdc++ with g++-10+ toolset on ubuntu noble).

It might work on g++-10, but for some reason the b2 check for if constexpr keep returning "no" for it.

Also fixed constexpr construction from strings and added some tests for construction/operations on dynamic allocated cpp_ints.

Had to make small changes to existing code to tackle some warnings given when compiled without the feature's support (such as uninitialized variables not being supported in constexpr methods before C++20).

@marcoffee marcoffee force-pushed the feature/more-constexpr branch from 1919202 to f1f2710 Compare February 13, 2025 23:27
@marcoffee marcoffee force-pushed the feature/more-constexpr branch 2 times, most recently from 4ac604d to 66564be Compare February 14, 2025 01:48
@marcoffee marcoffee force-pushed the feature/more-constexpr branch from 66564be to e6cb783 Compare February 14, 2025 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant