ANN: coutf library (alpha)

Discussion in 'C++' started by Oliver Schoenborn, May 21, 2005.

  1. alpha version of coutf library available at

    http://noptrlib.sf.net/utils/coutf/

    It provides printf-like output to streams (similar to boost::format):

    - almost identical to using printf
    - fast and simple, provides all essential aspect of printf formatting,
    and more (type safety, object output, etc)
    - almost no performance hit compared to direct output to std::eek:streams
    - holds in one short header file, so no linking etc

    Compared to boost::format it is
    - more function-like, easier to read, much faster
    - but not as comprehensive (e.g. no padding, no support for wchar_t (yet))
    - holds in one short header file, no dependencies on boost

    Example:

    std::string name = "foo";
    Time time; // defaults to current time
    const float radius=560.456; // approx. m
    coutf("Out: %s %s %4.1fs", name, time, radius, endl);

    prints to std::cout

    Out: foo 12:30pm 560.5 (newline and flush)

    Have fun!
    Oliver
     
    Oliver Schoenborn, May 21, 2005
    #1
    1. Advertising

  2. Re: coutf library (alpha)

    > It provides printf-like output to streams (similar to boost::format):
    http://noptrlib.sf.net/utils/coutf/

    Reading your webpage I ran into this:

    assuming "printf" stands for "print function", "coutf" makes a lot of sense,
    being sort of a "cout function"

    Printf does not stand for "print function", but for "print formatted".

    cheers,
    M.
     
    Marcin Kalicinski, May 21, 2005
    #2
    1. Advertising

  3. Oliver Schoenborn

    Rapscallion Guest

    Oliver Schoenborn wrote:
    > alpha version of coutf library available at
    >
    > http://noptrlib.sf.net/utils/coutf/
    >
    > It provides printf-like output to streams (similar to boost::format):
    >
    > - almost identical to using printf
    > - fast and simple, provides all essential aspect of printf

    formatting,
    > and more (type safety, object output, etc)
    > - almost no performance hit compared to direct output to

    std::eek:streams
    > - holds in one short header file, so no linking etc
    >
    > Compared to boost::format it is
    > - more function-like, easier to read, much faster
    > - but not as comprehensive (e.g. no padding, no support for wchar_t

    (yet))
    > - holds in one short header file, no dependencies on boost
    >
    > Example:
    >
    > std::string name = "foo";
    > Time time; // defaults to current time
    > const float radius=560.456; // approx. m
    > coutf("Out: %s %s %4.1fs", name, time, radius, endl);
    >
    > prints to std::cout
    >
    > Out: foo 12:30pm 560.5 (newline and flush)


    Very good! The interface is much cleaner and easier than Boost's
    (strange operator% overloadings). Another advantage is that there are
    no dependencies to other libraries. Question: Can I coutf my own
    classes?

    R.C.
     
    Rapscallion, May 22, 2005
    #3
  4. Rapscallion wrote:
    > Oliver Schoenborn wrote:
    >
    >>alpha version of coutf library available at
    >>
    >>http://noptrlib.sf.net/utils/coutf/
    >>
    >>It provides printf-like output to streams (similar to boost::format):
    >>
    >>- almost identical to using printf
    >>- fast and simple, provides all essential aspect of printf
    >>
    >> formatting, and more (type safety, object output, etc)
    >> [...snip...]

    >
    > Very good! The interface is much cleaner and easier than Boost's
    > (strange operator% overloadings). Another advantage is that there are
    > no dependencies to other libraries. Question: Can I coutf my own
    > classes?
    >
    > R.C.
    >


    Yep, with the usual magic necessary: i.e., as long as you define an
    operator<<(std::eek:stream&, const YourClass&).

    Oliver
     
    Oliver Schoenborn, May 25, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Rilling
    Replies:
    0
    Views:
    402
    Peter Rilling
    Feb 9, 2006
  2. =?ISO-8859-1?Q?J=FCrgen_Kahrs?=

    [ANN] alpha release of XMLgawk available

    =?ISO-8859-1?Q?J=FCrgen_Kahrs?=, Apr 10, 2005, in forum: XML
    Replies:
    0
    Views:
    410
    =?ISO-8859-1?Q?J=FCrgen_Kahrs?=
    Apr 10, 2005
  3. Tim Churches
    Replies:
    0
    Views:
    289
    Tim Churches
    Dec 30, 2004
  4. Daniel Bickett

    ANN: Concurrence 0.0.5.2 Alpha

    Daniel Bickett, Jun 18, 2005, in forum: Python
    Replies:
    0
    Views:
    347
    Daniel Bickett
    Jun 18, 2005
  5. Jacob Page

    ANN: interval module 0.2.0 (alpha)

    Jacob Page, Jul 10, 2005, in forum: Python
    Replies:
    0
    Views:
    288
    Jacob Page
    Jul 10, 2005
Loading...

Share This Page