Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Fun thing, is Rust employs the same trick. The HashSet<T> is an alias for HashMap<T, ()>. "()" is the unit type. Which is zero-sized.

Because Rust has generics, it is more ergonomic though.

https://doc.rust-lang.org/std/collections/struct.HashSet.htm...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: