SaaSHub helps you find the best software and product alternatives Learn more →
Mp-units Alternatives
Similar projects and alternatives to mp-units
-
-
InfluxDB
InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
-
-
-
-
-
-
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
-
-
SI
A header only C++ library that provides type safety and user defined literals for physical units (by bernedom)
-
-
-
-
small_vector
A fully featured single header library implementing a vector container with a small buffer optimization. (by gharveymn)
-
-
cpp-core-guidelines-cheatsheet
Cheatsheet for the C++ core guidelines, including a set of tried-and-true guidelines, rules, and best practices about coding in C++.
-
UNITS
a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
-
user-management
An open-source application delivering a responsive user management experience. (by prince-chrismc)
-
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
mp-units discussion
mp-units reviews and mentions
-
Python type hints may not be not for me in practice
I suspect C++ still comes the closest to what you’re asking for today, at least among mainstream programming languages.
Matrix dimensions are certainly doable, for example, because templates representing mathematical types like matrices and vectors can be parametrised by integers defining their dimension(s) as well as the type of an individual element.
You can also use template wizardry to write libraries like mp-units¹ or units² that provide explicit representations for numerical values with units. You can even get fancy with user-defined literals so you can write things like 0.5_m and have a suitably-typed value created (though that particular trick does get less useful once you need arbitrary compound units like kg·m·s⁻²).
Both of those are fairly well-defined problems and the solutions available do provide a good degree of static checking at compile time.
IMHO, the range question is the trickiest one of your three examples, because in real mathematical code there are so many different things you might want to constrain. You could define a parametrised type representing open or closed ranges of integers between X and Y easily enough, but how far down the rabbit hole do you go? Fractional values with attached precision/error metadata? The 572 specific varieties of matrix that get defined in a linear algebra textbook, and which variety you get back when you compute a product of any two of them?
¹ https://mpusz.github.io/mp-units/
² http://nholthaus.github.io/units/
-
What's the point of std:monostate? You can't do anything with it
There is indeed a units library [0] aiming for standardisation in C++29.
[0] https://github.com/mpusz/mp-units
-
Is it just mean, or is C# easier to learn than JavaScript or even PHP?
It's not the type system you're complaining about, though. It takes a bit of work but you can write types that include units information with no loss of performance.
-
I'm a beginner making a library for unit conversion, contributions are welcome
I recommend using this as reference https://github.com/mpusz/units it probably solves the same or similar problem.
-
Why is this piece of code compiling with char as c-tor argument?
Yep. And there are some libraries to provide strong-type int, depending on what you need: type_safe or even units.
-
C++'s smaller cleaner language
Indeed you cannot. Then again, you couldn't write a library like fmtlib in C in the first place. I mean why do you complain about C++ features which enable you to write libraries you otherwise couldn't? How would you expect to implement equivalent libraries to EVE or mp-units in C alone?
-
I got curious about units of measure in programming languages so I recreated xkcd/687.
How does it compare with https://github.com/mpusz/units ?
-
C++ for Mathematicians
I don't have a book to recommend, but I have a fantastic library: https://github.com/mpusz/units
- Cheatsheet for the C++ core guidelines (philosophy)
- Compile-time C++ library for compile-time dimensional analysis, units/quantities
-
A note from our sponsor - SaaSHub
www.saashub.com | 12 May 2025
Stats
mpusz/mp-units is an open source project licensed under MIT License which is an OSI approved license.
The primary programming language of mp-units is C++.