August 2017
Intermediate to advanced
438 pages
14h 19m
English
What happens in case of an incorrect format?
Nothing awful, an exception is thrown:
try { class_instance.to_string("%1% %2% %3% %4% %5%\n"); assert(false); } catch (const std::exception& e) { // boost::io::too_few_args exception is catched. std::cout << e.what() << '\n'; }
The following lines are outputted to the console by the previous code snippet:
boost::too_few_args: format-string referred to more arguments than were passed
C++17 has no std::format. The Boost.Format library is not a very fast library. Try not to use it in performance critical sections a lot.
Read now
Unlock full access