Oh man.

supports a user-defined literal. So if you define an `MyDistanceType operator""_km(long double val)` function, it'll allow you to say `const auto distance = 12_km;` and cause that to evaluate to a MyDistanceType representing 12 kilometers.

Cute, but I really can't see why anyone would bother when the language already supports `const auto distance = Distance::from_kilometers(12);`

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.