Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
C++: Checking units at compile time (2003) (everything2.com)
28 points by wfunction on Aug 19, 2014 | hide | past | favorite | 5 comments



Stroustrup discusses compile time units (starting at slide 19) in the following presentation:

http://ecn.channel9.msdn.com/events/GoingNative12/GN12Cpp11S...


Nice trick. One thing bothers me, couldn't the compiler use operator float and the construct from float for non-matching units?


I believe using those together counts as two user-defined conversions and is rejected. But one or both of those might as well be declared explicit.





Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: