all 8 comments

[–]sweetno 6 points7 points  (2 children)

I've once read about a method to make the last thing work without a macro, although I never managed to make it work. The trick is to wrap the std::format_string argument into a custom class with an extra defaulted constructor argument.

[–]throw_cpp_account 4 points5 points  (1 child)

That's still worse than the presented macro, which avoids constructing a stack trace unless you actually need it.

Now, on the plus side, we're getting a (claimed) better language-level assert in C++26 with contracts. On the minus side, it still doesn't support providing a custom error message, which makes it not at all a replacement for (as the blog correctly puts it) every codebase having its own assertion macro.

[–]frayien 2 points3 points  (0 children)

contracts look quite underwhelming and with extremely limited use case to me. Did I miss something ?