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

Improve the definition of a value-preserving conversion #517

Open
mpusz opened this issue Nov 10, 2023 · 2 comments
Open

Improve the definition of a value-preserving conversion #517

mpusz opened this issue Nov 10, 2023 · 2 comments
Labels
design Design-related discussion enhancement New feature or request gated Something else is blocking the resolution of this issue iso The ISO C++ Committee related work

Comments

@mpusz
Copy link
Owner

mpusz commented Nov 10, 2023

Right now wee clone std::chrono::duration duration. Consider the usage of one of the following:

@mpusz mpusz added enhancement New feature or request design Design-related discussion labels Nov 10, 2023
@JohelEGP
Copy link
Collaborator

From P0870R5:

[P2509R0] proposes a type trait which complements the present proposal, by detecting if a given target type can represent all the values of a given source type. This is different from detecting a narrowing conversion as defined by the core language; for instance, converting int to double is a narrowing conversion even on common platforms where double can actually precisely represent any int value.

@mpusz
Copy link
Owner Author

mpusz commented Nov 10, 2023

Yes, on the one hand, this is precisely what we want. On the other hand, this makes the code not portable.

@mpusz mpusz added gated Something else is blocking the resolution of this issue iso The ISO C++ Committee related work labels Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design-related discussion enhancement New feature or request gated Something else is blocking the resolution of this issue iso The ISO C++ Committee related work
Projects
None yet
Development

No branches or pull requests

2 participants