Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Is `struct Dip(f32)` always as fast as `f32`?
I have some UI layout code, and I was thinking of creating a new type to help keep my units straight.
/// Device independent pixels
struct Dip(f32)
impl Add for Dip { ... }
impl Mul for Dip { ... }
...
Is this always going to be as fast as raw f32
? I remember a C++ talk called something like "There are no zero cost abstractions".
7 posts - 6 participants
🏷️ rust_feed