Boost logo

Boost :

From: Bill Seymour (bill-at-the-office_at_[hidden])
Date: 2002-02-12 10:42:49


Itay wrote:
>
> std::string s;
> s = into_string<std::string>() << "current year: " << 2002 << ".\n";
>

- How is this better than std::ostringstream?

- If I'm using << operators, can I use I/O manipulators?

>
> int main(int argc, char* argv[])
> {
> int x = 4;
> int y = 6;
> std::string temp_s;
>
> temp_s = into_string<std::string>() << x << '*' << y << " = "
> << x*y << "!\n";
>
> std::cout << temp_s;
> return 0;
> }
>

int main(int argc, char* argv[])
{
   int x = 4;
   int y = 6;
   std::ostringstream temp_s;

   temp_s << x << '*' << y << " = " << x*y << "!\n";

   std::cout << temp_s;
   return 0;
}

--Bill Seymour


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