I was just taking a look and couldn't help but notice the switch statement for your operator[], which likely causes a lot of unnecessary bad speculation at runtime:
Many believe the C++ compiler will magically optimize the switch away, but in some cases, like the example above for CLHEP, it doesn't happen, so you end up with bad performance.
Amazing how the same people will go nuts for header-only C++ libraries, but the moment you involve an .a file, say "Noooo! you can't just vendor your dependencies! You need eight zillion apt dependencies!"
Container images are also just a worse version of static linking (giving you all of the downsides and missing several upsides). Ideally the industry moves to something like nix for most purposes, and static linking is used for embedded systems and teaching.
These do not seem to be pure "header-only", but involve #include-ing the same file at least once with "#define C2_xxx_IMPLEMENTATION 1"
That's fine though. AFAIK, there is no sane way (across platforms) to have singletons, and that involves some of the the trick above, unless you know someother way
These libraries are not compiled, packaged or distributed on their own; you have to include their code directly as part of your C/C++ game or app. You acquire and update them using git.
And if not using git, just fiddle around with a scripting language to automate the update, like check github's release API to see if there was some change between your local and the remote version somehow.
https://github.com/nothings/stb
https://github.com/RandyGaul/cute_headers/blob/755849fc2819d...
I fixed this exact problem in a highly used library in high energy physics:
https://gitlab.cern.ch/CLHEP/CLHEP/-/commit/5f20daf0cae91179...
Many believe the C++ compiler will magically optimize the switch away, but in some cases, like the example above for CLHEP, it doesn't happen, so you end up with bad performance.
https://github.com/RandyGaul/cute_headers/blob/755849fc2819d...
See an optimized quaternion multiplication implementation in SSE by me here:
https://stackoverflow.com/questions/18542894/how-to-multiply...
I'm sure I've also spotted him in the SDL channels.
https://github.com/RandyGaul/cute_framework
Header-only libraries are static linking.
That's fine though. AFAIK, there is no sane way (across platforms) to have singletons, and that involves some of the the trick above, unless you know someother way
If you do, please add your idea here - https://github.com/open-telemetry/opentelemetry-cpp/issues/2... - "Header only singletons are not working properly for Windows #2534"
I'm always suspicious of "Professional" in descriptions like this as it is a meaningless word you add to make it sound impressive.
Also, in this case it means a 900 line math library with 78 lines of tests...
The fact that invert_safe() isn't actually safe isn't the greatest look here though.