[boost::format] How to not display 0 integer?
Hello group I'm using boost::format heavily to format my output for user. I've run into a problem that I cannot resolve for now. I use this format: int i = 4; cout << format ("(%|1$+2|)") % i; // -> (+4) i = -4; cout << format ("(%|1$+2|)") % i; // -> (-4) That's fine and expected. But my question for the one below: int i = 0; cout << format ("(%|1$+2|)") % i; // -> ( 0) // -> ( ) how? How to avoid printing 0? I want formatter to print values in plus or in minus only. When there's value 0 - display only spaces to width. My problem is that I cannot create wrapper over that integer, I must feed formatter with int for various reasons. Does anyone know how to achive this? Maybe I override some parts of library or parsing method? Maybe some of you added your own formatts to formatter and want to share? Any hint or example would be valuable. Thanks in advance, Tomasz Kalkosiñski
participants (1)
-
tomasz2k@poczta.onet.pl