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

> I can't find a decent C++ units system. If one existed it would involve similarly grotesque templates full of std::enable_if and assorted wizardry.

Boost.Units is 20 years old. There is an unit system built in in c++11 just for duration, but shows what it can be done. There is no reason ever to use enable_if since C++20.

> Here's where Jai has a feature I've never seen before. I'm sure it exists in some language, but certainly not C++ or Rust!

The feature is #modify which is not needed in C++; for historical reasons, typically type level metaprogramming still different from value level, but it is not hard:

   https://gcc.godbolt.org/z/PbzKeh38a
Boost.Hana adds a lot of the required infrastructure.


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

Search: