Changes in src/Common/utility.h [843054c2:5f2f2d7]
- File:
-
- 1 edited
-
src/Common/utility.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
r843054c2 r5f2f2d7 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 15:34:57201513 // Update Count : 312 // Last Modified On : Mon Jun 8 14:43:54 2015 13 // Update Count : 13 14 14 // 15 15 … … 18 18 19 19 #include <iostream> 20 #include <s trstream>20 #include <sstream> 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::ostrstream os; 133 132 std::ostringstream os; 134 133 os << value; // << std::ends; 135 os.freeze( false ); 136 137 return std::string(os.str(), os.pcount()); 134 return os.str(); 138 135 } 139 136 … … 151 148 template< typename T > 152 149 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 >::iterator154 // ( g++ 3.2 issues a 'is implicitly a typename' warning if I make this explicit )155 150 typename std::list< T >::iterator next = pos; advance( next, 1 ); 156 151 … … 196 191 while ( b1 != e1 && b2 != e2 ) 197 192 *out++ = func(*b1++, *b2++); 193 } 194 195 // it's nice to actually be able to increment iterators by an arbitrary amount 196 template< typename Iterator > 197 Iterator operator+(Iterator i, int inc) { 198 while ( inc > 0 ) { 199 ++i; 200 --inc; 201 } 202 return i; 198 203 } 199 204
Note:
See TracChangeset
for help on using the changeset viewer.