Does the boost library provide an implementation of the safe bool idiom so that I can extract my class from it?
If so, where is it?
If not, what are my alternatives besides its implementation?
I found the following similar question: “ Is there a safe helper idiom for bool in boost? ” And the accepted answer assumes using bool_testable<> in Boost.Operators .
Unfortunately, when I checked boost manual , I could not find it. The code using it is also not compiled.
I also stumbled upon another SO question “ Was boost :: bool_testable <> moved or deleted? ” And the comment there says that bool_testable was actually never made for any version of boost.
There is also an interesting article > Bjorn Karlsson articles on a topic that contains code that could be copied to my project. However, I hope that there is a generally accepted and supported utility library (for example, boost) that already implements this.
For compatibility reasons, I don't want to rely on C ++ 11.
c ++ boost safe-bool-idiom
CygnusX1
source share