Boost logo

Boost :

From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2002-05-12 15:10:43


----- Original Message -----
From: "Giovanni Bajo" <giovannibajo_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, May 12, 2002 8:15 PM
Subject: [boost] String formatting library: interest?

> What I am proposing here is an 'extension' to std::string to add
formatting
> capabilities ala-sprintf, but in a type-safe, no-ellipsis manner.

> [...]

> cout << mystring("Hello, my name is %1 and I am %2 years
> old").arg("Giovanni").arg(999) << endl;

I forgot to specify what seemed obvious to me: mystring() can be used
whenever you'd use string(), it would contain a operator string(). There is
no "manual" support for std::cout or anything else, it would just seamlessly
integrate with your existing string() code:

std::ifstream file(mystring("data%1.dat").arg(datFileNum, 3, true));

Giovanni Bajo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk