Changes in src/Common/utility.h [5f2f2d7:843054c2]
- File:
-
- 1 edited
-
src/Common/utility.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r5f2f2d7 r843054c2 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 8 14:43:54201513 // Update Count : 1312 // Last Modified On : Tue May 19 15:34:57 2015 13 // Update Count : 3 14 14 // 15 15 … … 18 18 19 19 #include <iostream> 20 #include <s stream>20 #include <strstream> 21 21 #include <iterator> 22 22 #include <string> … … 60 60 for ( typename Container::const_iterator i = container.begin(); i != container.end(); ++i ) { 61 61 if ( *i ) { 62 os << std::string( indent, ' ');62 os << std::string(indent, ' '); 63 63 (*i)->print( os, indent + 2 ); 64 64 os << std::endl; … … 130 130 template < typename T > 131 131 std::string toString ( T value ) { 132 std::ostringstream os; 132 std::ostrstream os; 133 133 134 os << value; // << std::ends; 134 return os.str(); 135 os.freeze( false ); 136 137 return std::string(os.str(), os.pcount()); 135 138 } 136 139 … … 148 151 template< typename T > 149 152 void replace( std::list< T > &org, typename std::list< T >::iterator pos, std::list< T > &with ) { 153 // TIter should secretly be a typename std::list< T >::iterator 154 // ( g++ 3.2 issues a 'is implicitly a typename' warning if I make this explicit ) 150 155 typename std::list< T >::iterator next = pos; advance( next, 1 ); 151 156 … … 191 196 while ( b1 != e1 && b2 != e2 ) 192 197 *out++ = func(*b1++, *b2++); 193 }194 195 // it's nice to actually be able to increment iterators by an arbitrary amount196 template< typename Iterator >197 Iterator operator+(Iterator i, int inc) {198 while ( inc > 0 ) {199 ++i;200 --inc;201 }202 return i;203 198 } 204 199
Note:
See TracChangeset
for help on using the changeset viewer.