toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] tag/tag stdpp.h


From: Gerhard Reitmayr
Subject: [Toon-members] tag/tag stdpp.h
Date: Sun, 04 Jun 2006 12:08:35 +0000

CVSROOT:        /cvsroot/toon
Module name:    tag
Changes by:     Gerhard Reitmayr <gerhard>      06/06/04 12:08:35

Modified files:
        tag            : stdpp.h 

Log message:
        more constraint template parameters to avoid conflicts

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tag/tag/stdpp.h?cvsroot=toon&r1=1.4&r2=1.5

Patches:
Index: stdpp.h
===================================================================
RCS file: /cvsroot/toon/tag/tag/stdpp.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- stdpp.h     31 May 2006 16:46:20 -0000      1.4
+++ stdpp.h     4 Jun 2006 12:08:35 -0000       1.5
@@ -9,9 +9,15 @@
 /// This group contains enhancements to make the std library more useable
 
 /**
address@hidden print stream simplifications
-The comma operator for streams is defined to allow a simple statement similar 
to print in Python
-or other languages. The stream object and any values to be printed are written 
as a comma separated
address@hidden printgroup stream simplifications
+This group contains two sets of enhancements for using the output streams in 
the standard library.
+
+The first is a set of additional modifiers for use with the standard << 
operator. See @ref add_fill ,
address@hidden no_space and @ref print for more details.
+
+The second set introduces a new syntax using the comma operator for streams.
+It creates simple statements similar to print in Python or other languages.
+The stream object and any values to be printed are written as a comma separated
 list. Between the values printed, the stream's fill character is output to 
delimit values. Some examples:
 @code
 cout, 12, \"hello\", 13, endl;
@@ -35,26 +41,20 @@
     T & data;
 };
 
-template <class T, class O>
-inline NotFirst<O> operator,(O  & stream, const T & data ){
+template <class T, class Char, class Traits>
+inline NotFirst<std::basic_ostream<Char,Traits> > 
operator,(std::basic_ostream<Char,Traits>  & stream, const T & data ){
     stream << data;
-    return NotFirst<O>(stream);
+    return NotFirst<std::basic_ostream<Char,Traits> >(stream);
 }
 
-template <class T, class O>
-inline NotFirst<O> operator,(NotFirst<O> nf, const T & data ){
+template <class T, class Char, class Traits>
+inline NotFirst<std::basic_ostream<Char,Traits> > 
operator,(NotFirst<std::basic_ostream<Char,Traits> > nf, const T & data ){
     nf.data << nf.data.fill() << data;
     return nf;
 }
 
-template <class O>
-inline O & operator,(O  & stream, O & (*modifier)(O &)){
-    stream << modifier;
-    return stream;
-}
-
-template <class O>
-inline O & operator,(NotFirst<O> nf, O & (*modifier)(O &)){
+template <class Char, class Traits>
+inline std::basic_ostream<Char,Traits> & 
operator,(NotFirst<std::basic_ostream<Char,Traits> > nf, 
std::basic_ostream<Char,Traits> & (*modifier)(std::basic_ostream<Char,Traits> 
&)){
     nf.data << modifier;
     return nf.data;
 }
@@ -133,7 +133,7 @@
 1 2 3
 5 4
 @endcode
address@hidden print
address@hidden printgroup
 */
 static struct Internal::add_fill_s add_fill;
 
@@ -148,7 +148,7 @@
 1 2 3
 hello
 @endcode
address@hidden print
address@hidden printgroup
 */
 static struct Internal::like_print_s print;
 
@@ -162,7 +162,7 @@
 @code
 0 12 3
 @endcode
address@hidden print
address@hidden printgroup
 */
 static struct Internal::no_space_s no_space;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]