|
Boost Users : |
From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2004-10-21 12:26:15
On Thu, 21 Oct 2004 04:47:01 -0400, Miro Jurisic <macdev_at_[hidden]> wrote:
> In article <OFED98622A.E7230120-ONCA256F34.002B3C63_at_[hidden]>,
> "Barak Simon" <barak.simon_at_[hidden]> wrote:
>
> > I have noticed that the format library does not support at present the printf
> > asterisk for providing dynamic width as an extra parameter.
> > Unfortunately my users need to use this widely and I would really hate to
> > revert back to a non-typesafe solution.
>
> A typesafe solution is to use "format ("%1%") % string(buf, len)" if I understand the question correctly.
That would only work for string types. The * width specifier can be
used with ANY type, e.g.:
printf ("|%*d|", 6, 42);
Yields "| 42|".
-- Caleb Epstein caleb.epstein_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net