
I am just understanding format library, I came across an example. cout << boost::format("writing %1%, x=%2% : %3%-th step") % "toto" % 40.23 % 50; it prints "writing toto, x=40.230 : 50-th step" and another expression cout << format("writing %s, x=%s : %d-th step \n") % "toto" % 40.23 % 50; it prints "writing toto, x=40.23 : 50-th step " Both expression are printing same result. But these below two expressions give error cout << boost::format("writing %s, x=%2% : %3%-th step") % "toto" % 40.23 % 50; cout << format("writing %1%, x=%s : %d-th step \n") % "toto" % 40.23 % 50; If I am not wrong then this is because " format specifications can not be the combination of ordered types(%1%, %2%, ...) and unodered types(%s, %d, etc) " If this is true then this is the limitation of Format library in Boost or may be I am wrong. So what is the solution if I want to use combination of both types. This is just my requirement, it is not must to do in this way. Rahul To create something exceptional ________________________________ -Master4Master "Confidentiality Warning: This message and any attachments are intended only for the use of the intended recipient(s), are confidential, and may be privileged. If you are not the intended recipient, you are hereby notified that any review, re-transmission, conversion to hard copy, copying, circulation or other use of this message and any attachments is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email, and delete this message and any attachments from your system. Virus Warning: Although I have taken reasonable precautions to ensure no viruses are present in this email, I cannot accept responsibility for any loss or damage arising from the use of this email or attachment." Speak out for justice and peace, even if your voice trembles. Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/

On Tue, 30 Dec 2008 09:44:40 +0100, master master <master_4_master@yahoo.com> wrote:
[...]If I am not wrong then this is because " format specifications can not be the combination of ordered types(%1%, %2%, ...) and unodered types(%s, %d, etc) "
If this is true then this is the limitation of Format library in Boost or may be I am wrong. So what is the solution if I want to use combination of both types. This is just
It's true that Boost.Format doesn't allow combining ordered and unordered format specifiers. That said your only choice is using another library than Boost.Format? Boris
participants (2)
-
Boris
-
master master