Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
C++: Checking units at compile time (2003)
(
everything2.com
)
28 points
by
wfunction
on Aug 19, 2014
|
hide
|
past
|
favorite
|
5 comments
BenFrantzDale
on Aug 20, 2014
|
next
[–]
Also:
http://www.boost.org/doc/libs/1_56_0/doc/html/boost_units.ht...
rsorrel
on Aug 20, 2014
|
prev
|
next
[–]
Stroustrup discusses compile time units (starting at slide 19) in the following presentation:
http://ecn.channel9.msdn.com/events/GoingNative12/GN12Cpp11S...
im3w1l
on Aug 19, 2014
|
prev
|
next
[–]
Nice trick. One thing bothers me, couldn't the compiler use operator float and the construct from float for non-matching units?
coyotebush
on Aug 20, 2014
|
parent
|
next
[–]
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.
marvy
on Aug 20, 2014
|
prev
[–]
here is something harder:
http://yosefk.com/blog/can-your-static-type-system-handle-li...
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: