Skip to content

How to initialize quantity with value, and get numeric value back out. #619

Answered by JohelEGP
Cazadorro asked this question in Q&A
Discussion options

You must be logged in to vote

If you're OK with CTAD, you can use quantity(1, kHz): https://godbolt.org/z/9qqnWhPTj.
To get the value back, call .numerical_value_in(kHz) (see https://mpusz.github.io/mp-units/latest/users_guide/use_cases/working_with_legacy_interfaces/).

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@Cazadorro
Comment options

@JohelEGP
Comment options

@chiphogg
Comment options

Answer selected by Cazadorro
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@Cazadorro
Comment options

@chiphogg
Comment options

@mpusz
Comment options

@mpusz
Comment options

@Cazadorro
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants