The assert() macro has various issues, e.g., discussed here:
https://www.softwariness.com/articles/assertions-in-cpp/
We should follow the recommendation there and replace them with exceptions thrown.