Re: [Boost-bugs] [Boost C++ Libraries] #4454: iterator range output format, and for IO adaptor

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4454: iterator range output format, and for IO adaptor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-12 02:35:14


#4454: iterator range output format, and for IO adaptor
--------------------------------------------------------+-------------------
  Reporter: Akira Takahashi <faithandbrave@…> | Owner: neilgroves
      Type: Feature Requests | Status: assigned
 Milestone: Boost 1.44.0 | Component: range
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------------------------+-------------------

Comment (by giecrilj@…):

 Syntax:: `(cout << separated (range, " "))`

 == Implementation ==

 {{{
 #!c++

 namespace boost
 {
 namespace detail
 {
 template < class P_R, class P_C >
 struct output_range
 {
 typedef P_R range_type; typedef P_C char_type;
   range_type const &m_range; char_type const *m_sep;
   inline output_range
   (range_type const &p_r, char_type const p_s [])
     :m_range (p_r), m_sep (p_s) {}};
   template < class P_R, class P_C, class P_T >
   inline ::std ::basic_ostream < P_C, P_T >
   &operator <<
   (::std ::basic_ostream < P_C, P_T > &p_s,
    output_range < P_R, P_C > const &p_r)
   {
 ::boost ::copy
       (p_r. m_range,
        ::std ::ostream_iterator
        < typename ::boost ::range_value < P_R > ::type, P_C, P_T >
 (p_s, p_r .m_sep));
     return p_s; }}
   template < class P_R, class P_C >
   detail ::output_range < P_R, P_C >
   separated (P_R const &p_r, P_C const p_s [])
   { return detail ::output_range < P_R, P_C > (p_r, p_s); }
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4454#comment:5>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC