LB--

Results 116 comments of LB--

The format string argument is a variadic template type that receives the types of the other passed parameters, and its constructor is consteval so it must run at compile time....

I'd personally vote for always using `std::visit` (or the new `.visit`) unless you're just testing something quickly. Using `visit` is more verbose but there's a benefit to having to always...

It seems like your use of `std::optional` is making things more difficult for the compiler/optimizer to see through the code in this case, if we instead make the RAIIWrapper itself...

If your intent is for `RAIIFile` to always be valid, then remove the check in the destructor, and again the codegen changes more: https://godbolt.org/z/Wr3anPG81

You're right, if I make an equivalent change in the other code the issue persists. But maybe it's not that big of an issue since adding a simple read call...

Semi-relevant episode just aired today: [C++ Weekly - Ep 481 - What is Tail Call Elimination (Optimization)?](https://www.youtube.com/watch?v=cjiraPsZQIs)