I am offering my new library for the beman project and later for standardization. It is still under development and not meant for production yet. It is developed with the help of claude code ai.
We as C++ Programmers have a problem with int and double. I would put them in the same category as raw pointers, but while we have good types to replace raw pointers, the situation for int and double is not that good. There are already multiple safe integer libraries out there but all have their limitations and adoption is weak. I did not write a proposal first, but i hope i can spark some interest. I also included a dimensional units library derived from mp_units. I could not integrate my library with mp_units or chrono seamlessly, as there is overlap of responsibility. Think std::ratio. There is a pdf “int considered harmful” in the repo for further information and quite substantial documentation and examples. You can try out the library on compiler explorer. Link is in the Readme after the header.
It looks like you’ve put som effort into this and by looking at the README I’d say it looks nice, but I wonder if the Beman Project is a good fit before you’ve submitted a proposal: “… the project strives to aggregate libraries proposed for ISO standardization …”
I also did a quick search in your repo for the std:: saturation arithmetic functions (P0543) add_sat, sub_sat, mul_sat, div_sat and saturate_cast but couldn’t find any use. I’ll have to assume that’s because you want your library usable in C++23 and you’ve created compatible functions in your library but named them something else or that there’s no need for them in your library (which seems unlikely, but still).
I couldn’t find any use of the std:: functions cmp_equal, cmp_less, cmp_greater or std::in_range(t)either.
Is there an overlap between your inside library and the existing functions? Do your types work with the existing functions, should instances of them be passed to a saturation checking function etc.?
thanks for your reply. As i understand it, the saturation functions are only for standard integer types. This is to limited for what the inside library does on arbitrary grids. I only see benefits for performance optimization for special grids. To make the inside library safe, interoperation with standard integer types is limited on purpose and intended only on the boundary of input/output.
I was not aware of the cmp_* functions, but they also only support integers. They still might be helpful in the implementation.
To be honest, although the situation on int and doubles do improve slightly with more support functions, i see standard integer types as a low level facilities like raw pointers. Inside strives to be the save and fast replacement for normal use like unique_ptr is for raw pointers. My experience is that a replacement is needed, so i normaly do not supply conversion operators back out. There are to many flaws in what we currently have. Floating point is lossy and non determinstic (except on the lowest level IEEE754). Not enough guarantees on the result of math operations, etc.
To make C++ a better language we have to address these issues, thats why something like inside is needed in the standard and not only a standalone library. That is why i am here to ask if the beman project is interested in what inside tries to provide for c++.