Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > ANN: coutf library (alpha)

Reply
Thread Tools

ANN: coutf library (alpha)

 
 
Oliver Schoenborn
Guest
Posts: n/a
 
      05-21-2005
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: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
 
Reply With Quote
 
 
 
 
Marcin Kalicinski
Guest
Posts: n/a
 
      05-21-2005
> 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.


 
Reply With Quote
 
 
 
 
Rapscallion
Guest
Posts: n/a
 
      05-22-2005
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: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.

 
Reply With Quote
 
Oliver Schoenborn
Guest
Posts: n/a
 
      05-25-2005
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:stream&, const YourClass&).

Oliver
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static library Vs. Dynamic library iceColdFire C++ 3 05-17-2005 06:16 AM
Dynamic Library or Static Library under Linux gouqizi.lvcha@gmail.com C++ 6 05-10-2005 03:16 PM
Re: Difference between Web Control Library and Class Library Alan Ferrandiz [MCT] ASP .Net 0 09-11-2004 01:51 PM
Re: Difference between Web Control Library and Class Library Mythran ASP .Net 0 08-24-2004 05:53 PM
Library in library... Sweep C++ 1 12-09-2003 04:12 AM



Advertisments