Bjarne Stroustrup gave a keynote presentation today for the Going Native 2012 conference. In his presentation, he discussed the issue of enforcing correct units. His elegant (IMHO) solution to this involved using an operator I have never heard of before: operator""
. Using this operator, he was able to write C++ code that looked like this:
ratio = 100m / 1s;
Where operator""m(...)
and operator""s(...)
were defined.
Does anyone know of any documentation regarding how to actually use this operator (or even if any modern C++ compilers support it)? I tried searching online, but had no luck. Any help would be greatly appreciated.