Quick Q: Is the safe-bool idiom obsolete in C++11? -- StackOverflow

Quick A: Yes. Another way that modern C++ is safer and simpler.

(If you don't know what the safe-bool idiom is, don't worry. It's  a workaround that's now obsolete.)

Xeo asked:

Is the safe-bool idiom obsolete in C++11?

This answer of @R. Martinho Fernandes shows, that the safe-bool idiom is apperently deprecated in C++11, as it can be replaced by a simple

explicit operator bool() const;

... Is our assumption in the title correct? I hope we didn't overlook any potential drawbacks.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.