Printing bools with boost :: format as symbolic values?

How do I print booleans with boost :: format as symbolic values?

Can this be done without boost::io::group ? It seems that flags sent to the stream are pre-checked:

 #include <iomanip> #include <iostream> #include <boost/format.hpp> int main() { std::cout << std::boolalpha << true << " " << boost::format("%1% %2%\n") % true % boost::io::group(std::boolalpha, true) ; } 

Output

 true 1 true 
+4
source share
1 answer

I don’t think you can.

I looked at the Boost.Format documentation and code and saw nothing.

On the other hand, the sample code shows how to write a formatter for a custom type. You can write one for "bool"

+1
source

All Articles