Changeset 3153


Ignore:
Timestamp:
Jan 3, 2014, 7:39:09 AM (10 years ago)
Author:
Peter
Message:

document OstreamIterator? closes #770

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/OstreamIterator.h

    r3151 r3153  
    2727#include <boost/function_output_iterator.hpp>
    2828
    29 #include <iterator>
     29#include <functional>
    3030#include <ostream>
    3131#include <string>
     
    7373
    7474  /**
     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
    7593     \since New in yat 0.12
    7694  */
     
    89107    /**
    90108       \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
    93119    */
    94120    explicit OstreamIterator(std::ostream& os, const std::string& delimiter="")
Note: See TracChangeset for help on using the changeset viewer.