home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16258 < prev    next >
Encoding:
Text File  |  1992-11-14  |  1.1 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!uunet.ca!frumious!pat
  3. From: pat@frumious.uucp (Patrick Smith)
  4. Subject: Re: Just what is so great about streams?
  5. Message-ID: <1992Nov14.014733.534@frumious.uucp>
  6. Date: Sat, 14 Nov 1992 01:47:33 GMT
  7. Reply-To: uunet.ca!frumious!pat
  8. References: <1992Nov12.061942.16473@nuscc.nus.sg> <KANZE.92Nov13200446@slsvhat.us-es.sel.de>
  9. Organization: None
  10. Lines: 20
  11.  
  12. kanze@us-es.sel.de (James Kanze) writes:
  13. |Does anyone know of a better way of handling IO formatting in a
  14. |type-safe, extensible manner.  It's too late to change the iostream
  15. |syntax, but I am curious as to what the alternatives are.
  16.  
  17. I've always thought it would be nice to be able to write
  18. something like
  19.  
  20.    int i = 20, j = 17;
  21.    cout["i = %d, j = %d\n"] << i << j;
  22.  
  23. This wouldn't involve any loss of type safety, since a separate
  24. routine would be invoked for each type of value to be printed.
  25. With some work, it could probably also be set up so that it
  26. could be extended to printing user-defined types.
  27.  
  28. -- 
  29. Patrick Smith
  30. uunet.ca!frumious!pat
  31. pat%frumious.uucp@uunet.ca
  32.