Author: wyoung
Date: Fri Feb 15 10:57:38 2008
New Revision: 2206

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2206&view=rev
Log:
- Added Set::str(), doing just what you expect, to support
  stream2string, which Set::operator std::string() depends on
- Moved contents of Set::out_stream() into operator<< for Set, and
  removed function.  This is the way stream2string used to work.  No
  doubt it compiled before because it's a template never instantiated
  within the library.

Modified:
    trunk/lib/myset.h

Modified: trunk/lib/myset.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/myset.h?rev=2206&r1=2205&r2=2206&view=diff
==============================================================================
--- trunk/lib/myset.h (original)
+++ trunk/lib/myset.h Fri Feb 15 10:57:38 2008
@@ -92,29 +92,12 @@
                set2container(str.c_str(), set_insert(this));
        }
 
-       /// \brief Insert this set's data into a C++ stream in
-       /// comma-separated format.
-       std::ostream& out_stream(std::ostream& s) const
-       {
-               typename Container::const_iterator i = Container::begin();
-               typename Container::const_iterator e = Container::end();
-
-               if (i != e) {
-                       while (true) {
-                               s << *i;
-                               if (++i == e) {
-                                       break;
-                               }
-                               s << ",";
-                       }
-               }
-               
-               return s;
-       }
-
        /// \brief Convert this set's data to a string containing
        /// comma-separated items.
-       operator std::string() { return stream2string(*this); }
+       operator std::string() const { return stream2string(*this); }
+
+       /// \brief Return our value in std::string form
+       std::string str() const { return *this; }
 };
 
 
@@ -123,7 +106,20 @@
 inline std::ostream& operator <<(std::ostream& s,
                const Set<Container>& d)
 {
-       return d.out_stream(s);
+       typename Container::const_iterator i = d.begin();
+       typename Container::const_iterator e = d.end();
+
+       if (i != e) {
+               while (true) {
+                       s << *i;
+                       if (++i == e) {
+                               break;
+                       }
+                       s << ",";
+               }
+       }
+       
+       return s;
 }
 
 


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to