Changeset 3153
- Timestamp:
- Jan 3, 2014, 7:39:09 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/utility/OstreamIterator.h
r3151 r3153 27 27 #include <boost/function_output_iterator.hpp> 28 28 29 #include < iterator>29 #include <functional> 30 30 #include <ostream> 31 31 #include <string> … … 73 73 74 74 /** 75 OstreamIterator is an \output_iterator. Just like <a 76 href="http://www.sgi.com/tech/stl/ostream_iterator.html"> 77 std::ostream_iterator</a> it uses \c operator<<(ostream&, T) to 78 send formatted output to a particular ostream. While <a 79 href="http://www.sgi.com/tech/stl/ostream_iterator.html"> 80 std::ostream_iterator</a> inserts a string \a delimited after 81 each element, OstreamIterator only inserts \a delimiter between 82 elements. 83 84 \code 85 vector<int> x(3); 86 x[0] = 2; 87 x[1] = 3; 88 x[2] = 5; 89 copy(x.begin(), x.end(), OstreamIterator<int>(cout, ", ")); 90 \endcode 91 which will give output: 2, 3, 5 92 75 93 \since New in yat 0.12 76 94 */ … … 89 107 /** 90 108 \brief Constructor 91 \param os istream to extract string elements from. 92 \param delimiter the delimiting character. 109 110 Creates an OstreamIterator such that assignment of `t` through 111 it is equivalent to os << delimiter << t just like 112 std::ostream_iterator. The exception is that first time 113 OstreamIterator is derefenced the delimiter is excluded in 114 order to get the desired behaviour that delimiter only occurs 115 between elements. 116 117 \param os ostream to send output 118 \param delimiter the delimiting string 93 119 */ 94 120 explicit OstreamIterator(std::ostream& os, const std::string& delimiter="")
Note: See TracChangeset
for help on using the changeset viewer.