<html>
<head>
<title>Rvalue Reference Recommendations for Chapter 27</title>
<style>
p {text-align:justify}
li {text-align:justify}
blockquote.note
{
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
}
ins {background-color:#FFFFA0}
del {background-color:#FFFFA0}
</style>
</head>

<body>

<address align=right>
Document number: N1862=05-0122<br>
<br>
<a href="mailto:hinnant@twcny.rr.com">Howard E. Hinnant</a><br>
2005-08-26
</address>
<hr>

<h1 align=center>Rvalue Reference Recommendations for Chapter 27</h1>

<h2>Contents</h2>

<ul>
<li><a href="#Introduction">Introduction</a></li>
<li>
<a href="#27.4.4 - Class template basic_ios">27.4.4 - Class template
<tt>basic_ios</tt></a>
	<ul>
	<li><a href="#27.4.4.2 - Member functions">27.4.4.2 - Member functions</a></li>
	</ul>
</li>
<li>
<a href="#27.5.2 - Class template basic_streambuf&lt;charT,traits&gt;">27.5.2 -
Class template <tt>basic_streambuf&lt;charT,traits&gt;</tt></a>
	<ul>
	<li><a href="#27.5.2.1 - basic_streambuf constructors">27.5.2.1 - <tt>basic_streambuf</tt> constructors</a></li>
	<li><a href="#27.5.2.3 - basic_streambuf protected member functions">27.5.2.3 - <tt>basic_streambuf</tt> protected member functions</a></li>
	</ul>
</li>
<li>
<a href="#27.6 - Formatting and manipulators">27.6 - Formatting and
manipulators</a>
</li>
<li>
<a href="#27.6.1.1 - Class template basic_istream">27.6.1.1 - Class template
<tt>basic_istream</tt></a>
	<ul>
	<li><a href="#27.6.1.1.1 - basic_istream constructors">27.6.1.1.1 - <tt>basic_istream</tt> constructors</a></li>
	<li><a href="#27.6.1.1.3 - basic_istream member / non-member functions">27.6.1.1.3 - <tt>basic_istream</tt> member / non-member functions</a></li>
	<li><a href="#27.6.1.2.3 - basic_istream::operator&gt;&gt;">27.6.1.2.3 - <tt>basic_istream::operator&gt;&gt;</tt></a></li>
	</ul>
</li>
<li>
<a href="#27.6.1.5 - Class template basic_iostream">27.6.1.5 - Class template
<tt>basic_iostream</tt></a>
	<ul>
	<li><a href="#27.6.1.5.3 - basic_iostream member / non-member functions">27.6.1.5.3 - <tt>basic_iostream</tt> member / non-member functions</a></li>
	</ul>
</li>
<li>
<a href="#27.6.2.1 - Class template basic_ostream">27.6.2.1 - Class template
<tt>basic_ostream</tt></a>
	<ul>
	<li><a href="#27.6.2.2 - basic_ostream constructors">27.6.2.2 - <tt>basic_ostream</tt> constructors</a></li>
	<li><a href="#27.6.2.3 - basic_ostream member / non-member functions">27.6.2.3 - <tt>basic_ostream</tt> member / non-member functions</a></li>
	<li><a href="#27.6.2.6.4 - Character inserter function templates">27.6.2.6.4 - Character inserter function templates</a></li>
	</ul>
</li>
<li>
<a href="#27.7 - String-based streams">27.7 - String-based streams</a>
	<ul>
	<li>
	<a href="#27.7.1 - Class template basic_stringbuf">27.7.1 - Class template
<tt>basic_stringbuf</tt></a>
		<ul>
		<li><a href="#27.7.1.1 - basic_stringbuf constructors">27.7.1.1 - <tt>basic_stringbuf</tt> constructors</a></li>
		<li><a href="#27.7.1.2 - Member / non-member functions">27.7.1.2 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.7.2 - Class template basic_istringstream">27.7.2 - Class template
<tt>basic_istringstream</tt></a>
		<ul>
		<li><a href="#27.7.2.1 - basic_istringstream constructors">27.7.2.1 - <tt>basic_istringstream</tt> constructors</a></li>
		<li><a href="#27.7.2.2 - Member / non-member functions">27.7.2.2 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.7.3 - Class template basic_ostringstream">27.7.3 - Class template
<tt>basic_ostringstream</tt></a>
		<ul>
		<li><a href="#27.7.3.1 - basic_ostringstream constructors">27.7.3.1 - <tt>basic_ostringstream</tt> constructors</a></li>
		<li><a href="#27.7.3.2 - Member / non-member functions">27.7.3.2 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.7.4 - Class template basic_stringstream">27.7.4 - Class template
<tt>basic_stringstream</tt></a>
		<ul>
		<li><a href="#27.7.5 - basic_stringstream constructors">27.7.5 - <tt>basic_stringstream</tt> constructors</a></li>
		<li><a href="#27.7.6 - Member / non-member functions">27.7.6 - Member / non-member functions</a></li>
		</ul>
	</li>
	</ul>
</li>
<li>
<a href="#27.8.1 - File streams">27.8.1 - File streams</a>
	<ul>
	<li>
	<a href="#27.8.1.1 - Class template basic_filebuf">27.8.1.1 - Class template
<tt>basic_filebuf</tt></a>
		<ul>
		<li><a href="#27.8.1.2 - basic_filebuf constructors">27.8.1.2 - <tt>basic_filebuf</tt> constructors</a></li>
		<li><a href="#27.8.1.3 - Member / non-member functions">27.8.1.3 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.8.1.5 - Class template basic_ifstream">27.8.1.5 - Class template
<tt>basic_ifstream</tt></a>
		<ul>
		<li><a href="#27.8.1.6 - basic_ifstream constructors">27.8.1.6 - <tt>basic_ifstream</tt> constructors</a></li>
		<li><a href="#27.8.1.7 - Member / non-member functions">27.8.1.7 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.8.1.8 - Class template basic_ofstream">27.8.1.8 - Class template
<tt>basic_ofstream</tt></a>
		<ul>
		<li><a href="#27.8.1.9 - basic_ofstream constructors">27.8.1.9 - <tt>basic_ofstream</tt> constructors</a></li>
		<li><a href="#27.8.1.10 - Member / non-member functions">27.8.1.10 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.8.1.11 - Class template basic_fstream">27.8.1.11 - Class template
<tt>basic_fstream</tt></a>
		<ul>
		<li><a href="#27.8.1.12 - basic_fstream constructors">27.8.1.12 - <tt>basic_fstream</tt> constructors</a></li>
		<li><a href="#27.8.1.13 - Member / non-member functions">27.8.1.13 - Member / non-member functions</a></li>
		</ul>
	</li>
	<li>
	<a href="#27.7.4 - Class template basic_stringstream">27.7.4 - Class template
<tt>basic_stringstream</tt></a>
		<ul>
		<li><a href="#27.7.5 - basic_stringstream constructors">27.7.5 - <tt>basic_stringstream</tt> constructors</a></li>
		<li><a href="#27.7.6 - Member / non-member functions">27.7.6 - Member / non-member functions</a></li>
		</ul>
	</li>
	</ul>
</li>
</ul>

<h2>Related papers</h2>

<p>
<a href="n1856.html">Rvalue Reference Recommendations for Chapter 20</a><br>
<a href="n1857.html">Rvalue Reference Recommendations for Chapter 21</a><br>
<a href="n1858.html">Rvalue Reference Recommendations for Chapter 23</a><br>
<a href="n1859.html">Rvalue Reference Recommendations for Chapter 24</a><br>
<a href="n1860.html">Rvalue Reference Recommendations for Chapter 25</a><br>
<a href="n1861.html">Rvalue Reference Recommendations for Chapter 26</a>
</p>

<h2><a name="Introduction"></a>Introduction</h2>

<p>
This paper recommends proposed wording with respect to the
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1690.html">rvalue
reference</a> for the
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1804.pdf">C++0X
working draft</a>.
This paper restricts its scope to Chapter 27 "Input/output library" for the
purpose of breaking the library work associated with the rvalue reference up
into manageable chunks. This paper largely follows the lead of
<a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1771.html">N1771:
Impact of the rvalue reference on the Standard Library</a>, but adds more detail
as appropriate.
</p>

<p>
With the exception of this introduction, all non-proposed wording will have a
background color and formatting that
</p>
<blockquote class="note">
looks like this, so that motivation and description is more easily distinguished
from proposed wording.
</blockquote>
<p>
In the proposed wording below, text to be inserted is formatted like
<ins>this</ins>, while wording to be deleted is formatted like <del>this</del>.
</p>

<p>
The proposed wording in this paper:
</p>

<ul>
<li>Makes streams move constructible, move assignable and swappable.</li>
<li>Makes use of rvalue streams practical.</li>
</ul>

<p>
To facilitate this functionality low level protected functionality is added to
<tt>basic_ios</tt>, and the <tt>basic_streambuf</tt> class is given protected
copy and swap semantics.  The addition of these members makes it possible for clients to
create standard containers of streams while retaining stream integrity.  For example:
</p>

<blockquote><pre>
#include &lt;fstream&gt;
#include &lt;locale&gt;
#include &lt;vector&gt;
#include &lt;string&gt;

std::vector&lt;std::ofstream&gt;
create_files(const std::vector&lt;std::string&gt;&amp; names)
{
    std::vector&lt;std::ofstream&gt; files;
    for (unsigned i = 0; i &lt; names.size(); ++i)
    {
        files.push_back(std::ofstream(names[i].c_str()));
        files.back().imbue(std::locale(names[i].c_str()));
    }
    return files;
}

void
output(std::vector&lt;std::ofstream&gt;&amp; files, double amount)
{
    for (unsigned i = 0; i &lt; files.size(); ++i)
        files[i] &lt;&lt; amount;
}

int main()
{
    std::vector&lt;std::string&gt; names;
    names.push_back("english");
    names.push_back("french");
    // ...
    std::vector&lt;std::ofstream&gt; files = create_files(names);
    output(files, 12346.78);
}
</pre></blockquote>

<p>
The above example creates a <tt>vector&lt;ofstream&gt;</tt> where each element
refers to a file named by <tt>names[i]</tt> and imbued by a locale by the
same name (just to keep the example brief).  The container of <tt>ofstream</tt>
can be efficiently returned by value from a factory function, but can't be truly
copied.  That is, there is no way to accidently get into a situation where two
streams will refer to the same file.  A utility to
output the same double to each file, but formatted for each locale is easily
written just to show a motivating use case for sequences of streams.
</p>

<p>
Additionally, with movable streams one can manipulate the stream sequence with
standard algorithms, perhaps checking for streams that are bad and getting rid
of them (just as an example):
</p>

<blockquote><pre>
files.erase(
    remove_if(files.begin(),
              files.end(),
              bind(&ofstream::bad, _1)
    ),
    files.end()
);
</pre></blockquote>

<p>
This kind of functionality is achievable today with <tt>vector&lt;shared_ptr&lt;ofstream&gt; &gt;</tt>.  However this rewrite is less readable, more expensive, and not as safe as it allows
the possibility that two containers might refer to the same set of files.
</p>

<blockquote><pre>
void erase_bad_files(file_container files) {...}
...
erase_bad_files(files);
</pre></blockquote>

<p>
The above code is a silent run time error if <tt>file_container</tt> is a
<tt>vector&lt;shared_ptr&lt;ofstream&gt; &gt;</tt>, but a compile time error
if it is a <tt>vector&lt;ofstream&gt;</tt>.  The error is a missing <tt>&amp;</tt>.
</p>

<blockquote><pre>
void erase_bad_files(file_container<ins>&amp;</ins> files) {...}
</pre></blockquote>

<p>
Otherwise a <i>copy</i> of the container is modified (and <tt>vector&lt;ofstream&gt;</tt>
can not be copied).
</p>

<p>
In addition to making the streams movable, this paper proposes wording that allows clients
to use the <tt>istream</tt> extractors and the <tt>ostream</tt> inserters for characters and
character arrays with rvalue streams:
</p>

<blockquote><pre>
ofstream("log", ios::app) << "message"; // open file, write message, close file
</pre></blockquote>

<h2><a name="27.4.4 - Class template basic_ios"></a>27.4.4 - Class template <tt>basic_ios</tt></h2>

<blockquote class="note">
<p>
The proposed wording in this section adds three new protected member functions
to <tt>basic_ios</tt>: </p>

<blockquote><pre>
void move(basic_ios&amp;&amp; <i>rhs</i>);
void swap(basic_ios&amp;&amp; <i>rhs</i>);
void set_rdbuf(basic_streambuf&lt;charT, traits&gt;* <i>sb</i>);
</pre></blockquote>

<p>
These aid derived classes in implementing a move constructor, move assignment
and member swap. </p>
</blockquote>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_ios : public ios_base {
  public:

    //<i>  Types:</i>
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    operator void*() const
    bool operator!() const
    iostate rdstate() const;
    void clear(iostate <i>state</i> = goodbit);
    void setstate(iostate <i>state</i>);
    bool good() const;
    bool eof()  const;
    bool fail() const;
    bool bad()  const;

    iostate exceptions() const;
    void exceptions(iostate <i>except</i>);

    //<i>  <a href="lib-iostreams.html#lib.basic.ios.cons">lib.basic.ios.cons</a> Constructor/destructor:</i>
    explicit basic_ios(basic_streambuf&lt;charT,traits&gt;* <i>sb</i>);
    virtual ~basic_ios();

    //<i>  <a href="lib-iostreams.html#lib.basic.ios.members">lib.basic.ios.members</a> Members:</i>
    basic_ostream&lt;charT,traits&gt;* tie() const;
    basic_ostream&lt;charT,traits&gt;* tie(basic_ostream&lt;charT,traits&gt;* <i>tiestr</i>);

    basic_streambuf&lt;charT,traits&gt;* rdbuf() const;
    basic_streambuf&lt;charT,traits&gt;* rdbuf(basic_streambuf&lt;charT,traits&gt;* <i>sb</i>);

    basic_ios&amp; copyfmt(const basic_ios&amp; <i>rhs</i>);

    char_type fill() const;
    char_type fill(char_type <i>ch</i>);

    //<i>  <a href="lib-iostreams.html#lib.ios.base.locales">lib.ios.base.locales</a> locales:</i>
    locale imbue(const locale&amp; <i>loc</i>);

    char     narrow(char_type <i>c</i>, char dfault) const;
    char_type widen(char <i>c</i>) const;

  protected:
    basic_ios();
    void init(basic_streambuf&lt;charT,traits&gt;* <i>sb</i>);
    <ins>void move(basic_ios&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_ios&amp;&amp; <i>rhs</i>);</ins>
    <ins>void set_rdbuf(basic_streambuf&lt;charT, traits&gt;* <i>sb</i>);</ins>

  private:
    basic_ios(const basic_ios&amp; );       //<i>  not defined</i>
    basic_ios&amp; operator=(const basic_ios&amp;);     //<i>  not defined</i>
  };
}
</pre></blockquote>

<h3><a name="27.4.4.2 - Member functions"></a>27.4.4.2 - Member functions</h3>

<blockquote><pre><ins>
void move(basic_ios&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-20- <i>Effects:</i> The state which <tt><i>rhs</i></tt> which had at the
beginning of the call is transferred to <tt>*this</tt>, except for
<tt>rdbuf()</tt>.
</ins></p>

<p><ins>
-21- <i>Postconditions:</i>
</ins></p>

<blockquote><ul>
<li><ins><tt>*this</tt> now has the state <tt><i>rhs</i></tt> had, except</ins></li>
<li><ins><tt>rdbuf() == 0</tt>.</ins></li>
<li><ins><tt><i>rhs</i>.rdbuf()</tt> is unchanged.</ins></li>
<li><ins><tt><i>rhs</i>.tie() == 0</tt>.</ins></li>
<li><ins>The state of <tt><i>rhs</i></tt> is otherwise undefined but valid.</ins></li>
</ul></blockquote>

<blockquote><pre><ins>
void swap(basic_ios&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-22- <i>Effects:</i> Except for <tt>rdbuf()</tt>, the states of <tt>*this</tt>
and <tt><i>rhs</i></tt> are exchanged.
</ins></p>

<p><ins>
-23- <i>Throws:</i> Nothing.
</ins></p>

<blockquote><pre><ins>
void set_rdbuf(basic_streambuf&lt;charT, traits&gt;* <i>sb</i>);
</ins></pre></blockquote>

<p><ins>
-24- <i>Effects:</i> Associates the <tt>streambuf <i>sb</i></tt> with this
stream without calling <tt>clear()</tt>.
</ins></p>

<p><ins>
-25- <i>Postconditions:</i> <tt>rdbuf() == <i>sb</i></tt>.
</ins></p>

<p><ins>
-26- <i>Throws:</i> Nothing.
</ins></p>

<h2><a name="27.5.2 - Class template basic_streambuf&lt;charT,traits&gt;"></a>27.5.2 - Class template <tt>basic_streambuf&lt;charT,traits&gt;</tt></h2>

<blockquote class="note">
<p>
The proposed wording in this section gives <tt>basic_streambuf</tt> protected
copy semantics, and a protected member swap.  These new members aid derived
classes in implementing a move constructor, move assignment operator and member
swap.  This impacts
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#421">lwg
issue 421</a>
which concerns whether or not <tt>basic_streambuf</tt> has copy semantics.  The
proposed wording herein compromises with protected copy semantics (as opposed to
public) which is just enough functionality to aid derived classes. </p>
</blockquote>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_streambuf {
  public:

    //<i>  Types:</i>
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    virtual ~basic_streambuf();

    //<i>  <a href="lib-iostreams.html#lib.streambuf.locales">lib.streambuf.locales</a> locales:</i>
    locale   pubimbue(const locale &amp;<i>loc</i>);
    locale   getloc() const;

    //<i>  <a href="lib-iostreams.html#lib.streambuf.buffer">lib.streambuf.buffer</a> buffer and positioning:</i>
    basic_streambuf&lt;char_type,traits&gt;*
             pubsetbuf(char_type* <i>s</i>, streamsize <i>n</i>);
    pos_type pubseekoff(off_type <i>off</i>, ios_base::seekdir <i>way</i>,
                        ios_base::openmode <i>which</i> =
                            ios_base::in | ios_base::out);
    pos_type pubseekpos(pos_type <i>sp</i>,
                        ios_base::openmode <i>which</i> =
                            ios_base::in | ios_base::out);
    int      pubsync();

    //<i>  Get and put areas:</i>
    //<i>  <a href="lib-iostreams.html#lib.streambuf.pub.get">lib.streambuf.pub.get</a> Get area:</i>
    streamsize in_avail();
    int_type snextc();
    int_type sbumpc();
    int_type sgetc();
    streamsize sgetn(char_type* <i>s</i>, streamsize  <i>n</i>);

    //<i>  <a href="lib-iostreams.html#lib.streambuf.pub.pback">lib.streambuf.pub.pback</a> Putback:</i>
    int_type sputbackc(char_type <i>c</i>);
    int_type sungetc();

    //<i>  <a href="lib-iostreams.html#lib.streambuf.pub.put">lib.streambuf.pub.put</a> Put area:</i>
    int_type   sputc(char_type <i>c</i>);
    streamsize sputn(const char_type* <i>s</i>, streamsize  <i>n</i>);

  protected:
    basic_streambuf();
    <ins>basic_streambuf(const basic_streambuf&amp; <i>rhs</i>);</ins>
    <ins>basic_streambuf&amp; operator=(const basic_streambuf&amp; <i>rhs</i>);</ins>

    <ins>void swap(basic_streambuf&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.streambuf.get.area">lib.streambuf.get.area</a> Get area:</i>
    char_type* eback() const;
    char_type* gptr()  const;
    char_type* egptr() const;
    void       gbump(int <i>n</i>);
    void       setg(char_type* <i>gbeg</i>, char_type* <i>gnext</i>, char_type* <i>gend</i>);

    //<i>  <a href="lib-iostreams.html#lib.streambuf.put.area">lib.streambuf.put.area</a> Put area:</i>
    char_type* pbase() const;
    char_type* pptr() const;
    char_type* epptr() const;
    void       pbump(int <i>n</i>);
    void       setp(char_type* <i>pbeg</i>, char_type* <i>pend</i>);

    //<i>  <a href="lib-iostreams.html#lib.streambuf.virtuals">lib.streambuf.virtuals</a> virtual functions:</i>
    //<i>  <a href="lib-iostreams.html#lib.streambuf.virt.locales">lib.streambuf.virt.locales</a> Locales:</i>
    virtual void imbue(const locale &amp;<i>loc</i>);

    //<i>  <a href="lib-iostreams.html#lib.streambuf.virt.buffer">lib.streambuf.virt.buffer</a> Buffer management and positioning:</i>
    virtual basic_streambuf&lt;char_type,traits&gt;*
                     setbuf(char_type* <i>s</i>, streamsize <i>n</i>);
    virtual pos_type seekoff(off_type <i>off</i>, ios_base::seekdir <i>way</i>,
              ios_base::openmode <i>which</i> = ios_base::in | ios_base::out);
    virtual pos_type seekpos(pos_type <i>sp</i>,
              ios_base::openmode <i>which</i> = ios_base::in | ios_base::out);
    virtual int      sync();

    //<i>  <a href="lib-iostreams.html#lib.streambuf.virt.get">lib.streambuf.virt.get</a> Get area:</i>
    virtual streamsize showmanyc();
    virtual streamsize xsgetn(char_type* <i>s</i>, streamsize <i>n</i>);
    virtual int_type   underflow();
    virtual int_type   uflow();

    //<i>  <a href="lib-iostreams.html#lib.streambuf.virt.pback">lib.streambuf.virt.pback</a> Putback:</i>
    virtual int_type   pbackfail(int_type <i>c</i> = traits::eof());

    //<i>  <a href="lib-iostreams.html#lib.streambuf.virt.put">lib.streambuf.virt.put</a> Put area:</i>
    virtual streamsize xsputn(const char_type* <i>s</i>, streamsize <i>n</i>);
    virtual int_type   overflow (int_type <i>c</i> = traits::eof());
  };
}
</pre></blockquote>

<h3><a name="27.5.2.1 - basic_streambuf constructors"></a>27.5.2.1 - <tt>basic_streambuf</tt> constructors</h3>

<blockquote><pre><ins>
basic_streambuf(const basic_streambuf&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Constructs a copy of <tt><i>rhs</i></tt>.
</ins></p>

<p><ins>
-4- <i>Postconditions:</i>
</ins></p>

<ul>
<li><ins><tt>eback() == <i>rhs</i>.eback()</tt></ins></li>
<li><ins><tt>gptr() == <i>rhs</i>.gptr()</tt></ins></li>
<li><ins><tt>egptr() == <i>rhs</i>.egptr()</tt></ins></li>
<li><ins><tt>pbase() == <i>rhs</i>.pbase()</tt></ins></li>
<li><ins><tt>pptr() == <i>rhs</i>.pptr()</tt></ins></li>
<li><ins><tt>epptr() == <i>rhs</i>.epptr()</tt></ins></li>
<li><ins><tt>getloc() == <i>rhs</i>.getloc()</tt></ins></li>
</ul>

<h3><a name="27.5.2.3 - basic_streambuf protected member functions"></a>27.5.2.3 - <tt>basic_streambuf</tt> protected member functions</h3>

<blockquote><pre><ins>
basic_streambuf&amp; operator=(const basic_streambuf&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-1- <i>Effects:</i> Assigns the data members of <tt><i>rhs</i></tt> to
<tt>*this</tt>.
</ins></p>

<p><ins>
-2- <i>Postconditions:</i>
</ins></p>

<ul>
<li><ins><tt>eback() == <i>rhs</i>.eback()</tt></ins></li>
<li><ins><tt>gptr() == <i>rhs</i>.gptr()</tt></ins></li>
<li><ins><tt>egptr() == <i>rhs</i>.egptr()</tt></ins></li>
<li><ins><tt>pbase() == <i>rhs</i>.pbase()</tt></ins></li>
<li><ins><tt>pptr() == <i>rhs</i>.pptr()</tt></ins></li>
<li><ins><tt>epptr() == <i>rhs</i>.epptr()</tt></ins></li>
<li><ins><tt>getloc() == <i>rhs</i>.getloc()</tt></ins></li>
</ul>

<p><ins>
-3- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_streambuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> Swaps the data members of <tt><i>rhs</i></tt> and
<tt>*this</tt>.
</ins></p>

<h2><a name="27.6 - Formatting and manipulators"></a>27.6 - Formatting and manipulators</h2>

<p>
<b>Header <tt>&lt;istream&gt;</tt> synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_istream;
  typedef basic_istream&lt;char&gt;     istream;
  typedef basic_istream&lt;wchar_t&gt; wistream;

  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_iostream;
  typedef basic_iostream&lt;char&gt;    iostream;
  typedef basic_iostream&lt;wchar_t&gt; wiostream;

  template &lt;class charT, class traits&gt;
    basic_istream&lt;charT,traits&gt;&amp; ws(basic_istream&lt;charT,traits&gt;&amp; <i>is</i>);

  <ins>template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;& x, basic_istream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;&& x, basic_istream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;& x, basic_istream&lt;charT, traits&gt;&& y);

  template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;& x, basic_iostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;&& x, basic_iostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;& x, basic_iostream&lt;charT, traits&gt;&& y);</ins>
}
</pre></blockquote>

<p>
<b>Header <tt>&lt;ostream&gt;</tt> synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_ostream;
  typedef basic_ostream&lt;char&gt;     ostream;
  typedef basic_ostream&lt;wchar_t&gt; wostream;

  template &lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; endl(basic_ostream&lt;charT,traits&gt;&amp; <i>os</i>);
  template &lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; ends(basic_ostream&lt;charT,traits&gt;&amp; <i>os</i>);
  template &lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; flush(basic_ostream&lt;charT,traits&gt;&amp; <i>os</i>);

  <ins>template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;& x, basic_ostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;&& x, basic_ostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;& x, basic_ostream&lt;charT, traits&gt;&& y);</ins>
}
</pre></blockquote>

<h2><a name="27.6.1.1 - Class template basic_istream"></a>27.6.1.1 - Class template <tt>basic_istream</tt></h2>

<blockquote class="note">
<p>
The proposed wording in this section gives <tt>basic_istream</tt> a move
constructor, move assignment operator, member swap, and namespace scope swap
functions.  The namespace scope extractors taking characters and character
strings are modified to work with rvalue <tt>basic_istream</tt>s. </p>
</blockquote>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_istream : virtual public basic_ios&lt;charT,traits&gt; {
  public:
  //<i>  Types (inherited from  </i>basic_ios<i>  (<a href="lib-iostreams.html#lib.ios">lib.ios</a>)):</i>
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.istream.cons">lib.istream.cons</a> Constructor/destructor:</i>
    explicit basic_istream(basic_streambuf&lt;charT,traits&gt;* <i>sb</i>);
    <ins>basic_istream(basic_istream&amp;&amp; <i>rhs</i>);</ins>
    virtual ~basic_istream();

    <ins>basic_istream&amp; operator=(basic_istream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_istream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.istream::sentry">lib.istream::sentry</a> Prefix/suffix:</i>
    class sentry;

    //<i>  <a href="lib-iostreams.html#lib.istream.formatted">lib.istream.formatted</a> Formatted input:</i>
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;
        (basic_istream&lt;charT,traits&gt;&amp; (*<i>pf</i>)(basic_istream&lt;charT,traits&gt;&amp;))
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;
        (basic_ios&lt;charT,traits&gt;&amp; (*<i>pf</i>)(basic_ios&lt;charT,traits&gt;&amp;))
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;
        (ios_base&amp; (*<i>pf</i>)(ios_base&amp;))

    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(bool&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(short&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(unsigned short&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(int&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(unsigned int&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(long&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(unsigned long&amp; <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(float&amp; <i>f</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(double&amp; <i>f</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(long double&amp; <i>f</i>);

    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(void*&amp; <i>p</i>);
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;
        (basic_streambuf&lt;char_type,traits&gt;* <i>sb</i>);

    //<i>  <a href="lib-iostreams.html#lib.istream.unformatted">lib.istream.unformatted</a> Unformatted input:</i>
    streamsize gcount() const;
    int_type get();
    basic_istream&lt;charT,traits&gt;&amp; get(char_type&amp; <i>c</i>);
    basic_istream&lt;charT,traits&gt;&amp; get(char_type* <i>s</i>, streamsize <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; get(char_type* <i>s</i>, streamsize <i>n</i>,
                      char_type <i>delim</i>);
    basic_istream&lt;charT,traits&gt;&amp; get(basic_streambuf&lt;char_type,traits&gt;&amp; <i>sb</i>);
    basic_istream&lt;charT,traits&gt;&amp; get(basic_streambuf&lt;char_type,traits&gt;&amp; <i>sb</i>,
                      char_type <i>delim</i>);

    basic_istream&lt;charT,traits&gt;&amp; getline(char_type* <i>s</i>, streamsize <i>n</i>);
    basic_istream&lt;charT,traits&gt;&amp; getline(char_type* <i>s</i>, streamsize <i>n</i>,
                      char_type <i>delim</i>);

    basic_istream&lt;charT,traits&gt;&amp; ignore
        (streamsize <i>n</i> = 1, int_type <i>delim</i> = traits::eof());
    int_type                     peek();
    basic_istream&lt;charT,traits&gt;&amp; read    (char_type* <i>s</i>, streamsize <i>n</i>);
    streamsize                   readsome(char_type* <i>s</i>, streamsize <i>n</i>);

    basic_istream&lt;charT,traits&gt;&amp; putback(char_type <i>c</i>);
    basic_istream&lt;charT,traits&gt;&amp; unget();
    int sync();

    pos_type tellg();
    basic_istream&lt;charT,traits&gt;&amp; seekg(pos_type);
    basic_istream&lt;charT,traits&gt;&amp; seekg(off_type, ios_base::seekdir);
  };

  //<i>  <a href="lib-iostreams.html#lib.istream::extractors">lib.istream::extractors</a> character extraction templates:</i>
  template&lt;class charT, class traits&gt;
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;charT,traits&gt;&amp;<ins>&amp;</ins>,
                                            charT&amp;);
  template&lt;class traits&gt;
    basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                           unsigned char&amp;);
  template&lt;class traits&gt;
    basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                           signed char&amp;);

  template&lt;class charT, class traits&gt;
    basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;charT,traits&gt;&amp;<ins>&amp;</ins>,
                                            charT*);
  template&lt;class traits&gt;
    basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                           unsigned char*);
  template&lt;class traits&gt;
    basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                           signed char*);
  <ins>template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;& x, basic_istream&lt;charT, traits&gt;& y);

  template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;&& x, basic_istream&lt;charT, traits&gt;& y);

  template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;& x, basic_istream&lt;charT, traits&gt;&& y);</ins>
}
</pre></blockquote>

<h3><a name="27.6.1.1.1 - basic_istream constructors"></a>27.6.1.1.1 - <tt>basic_istream</tt> constructors</h3>

<blockquote><pre><ins>
basic_istream(basic_istream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by default constructing the base class, copying the
<tt>gcount()</tt> from <tt><i>rhs</i></tt>, calling <tt>basic_ios&lt;charT,
traits&gt;::move(<i>rhs</i>)</tt> to initialize the base class, and setting the
<tt>gcount()</tt> for <tt><i>rhs</i></tt> to 0.
</ins></p>

<h3><a name="27.6.1.1.3 - basic_istream member / non-member functions"></a><ins>27.6.1.1.3 - <tt>basic_istream</tt> member / non-member functions</ins></h3>

<blockquote><pre><ins>
basic_istream&amp; operator=(basic_istream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-1- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-2- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_istream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Calls <tt>basic_ios&lt;charT,
traits&gt;::swap(<i>rhs</i>)</tt>.  Exchanges the values returned by
<tt>gcount()</tt> and <tt><i>rhs</i>.gcount()</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;& <i>x</i>, basic_istream&lt;charT, traits&gt;& <i>y</i>);
template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;&& <i>x</i>, basic_istream&lt;charT, traits&gt;& <i>y</i>);
template &lt;class charT, class traits&gt;
    void swap(basic_istream&lt;charT, traits&gt;& <i>x</i>, basic_istream&lt;charT, traits&gt;&& <i>y</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> <tt><i>x</i>.swap(<i>y</i>)</tt>.
</ins></p>

<h3><a name="27.6.1.2.3 - basic_istream::operator&gt;&gt;"></a>27.6.1.2.3 - <tt>basic_istream::operator&gt;&gt;</tt></h3>

<blockquote><pre>
template&lt;class charT, class traits&gt;
  basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;charT,traits&gt;&amp;<ins>&amp;</ins>,
                                          charT&amp;);
template&lt;class traits&gt;
  basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                         unsigned char&amp;);
template&lt;class traits&gt;
  basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                         signed char&amp;);

template&lt;class charT, class traits&gt;
  basic_istream&lt;charT,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;charT,traits&gt;&amp;<ins>&amp;</ins>,
                                          charT*);
template&lt;class traits&gt;
  basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                         unsigned char*);
template&lt;class traits&gt;
  basic_istream&lt;char,traits&gt;&amp; operator&gt;&gt;(basic_istream&lt;char,traits&gt;&amp;<ins>&amp;</ins>,
                                         signed char*);
</pre></blockquote>

<h2><a name="27.6.1.5 - Class template basic_iostream"></a>27.6.1.5 - Class template <tt>basic_iostream</tt></h2>

<blockquote class="note">
<p>
The proposed wording in this section gives <tt>basic_iostream</tt> a move
constructor, move assignment operator, member swap, and namespace scope swap
functions. </p>
</blockquote>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_iostream :
    public basic_istream&lt;charT,traits&gt;,
    public basic_ostream&lt;charT,traits&gt; {
  public:
    //<i>  constructor/destructor</i>
    explicit basic_iostream(basic_streambuf&lt;charT,traits&gt;* sb);
    <ins>basic_iostream(basic_iostream&amp;&amp; <i>rhs</i>);</ins>
    virtual ~basic_iostream();

    <ins>basic_iostream&amp; operator=(basic_iostream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_iostream&amp;&amp; <i>rhs</i>);</ins>
  };

  <ins>template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;& x, basic_iostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;&& x, basic_iostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;& x, basic_iostream&lt;charT, traits&gt;&& y);</ins>
}
</pre></blockquote>

<h3><a name="27.6.1.5.1 - basic_iostream constructors"></a>27.6.1.5.1 - <tt>basic_iostream</tt> constructors</h3>

<blockquote><pre><ins>
basic_iostream(basic_iostream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt> by
constructing the <tt>basic_istream</tt> base class with
<tt>move(<i>rhs</i>)</tt>.
</ins></p>

<h3><a name="27.6.1.5.3 - basic_iostream member / non-member functions"></a><ins>27.6.1.5.3 - <tt>basic_iostream</tt> member / non-member functions</ins></h3>

<blockquote><pre><ins>
basic_iostream&amp; operator=(basic_iostream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-1- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-2- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_iostream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Calls <tt>basic_istream&lt;charT,
traits&gt;::swap(<i>rhs</i>)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;& <i>x</i>, basic_iostream&lt;charT, traits&gt;& <i>y</i>);
template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;&& <i>x</i>, basic_iostream&lt;charT, traits&gt;& <i>y</i>);
template &lt;class charT, class traits&gt;
    void swap(basic_iostream&lt;charT, traits&gt;& <i>x</i>, basic_iostream&lt;charT, traits&gt;&& <i>y</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> <tt><i>x</i>.swap(<i>y</i>)</tt>.
</ins></p>

<h2><a name="27.6.2.1 - Class template basic_ostream"></a>27.6.2.1 - Class template <tt>basic_ostream</tt></h2>

<blockquote class="note">
<p>
The proposed wording in this section gives <tt>basic_ostream</tt> a move
constructor, move assignment operator, member swap, and namespace scope swap
functions.  The namespace scope inserters taking characters and character
strings are modified to work with rvalue <tt>basic_ostream</tt>s. </p>
</blockquote>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_ostream : virtual public basic_ios&lt;charT,traits&gt; {
  public:
  //<i>  Types (inherited from  </i>basic_ios<i>  (<a href="lib-iostreams.html#lib.ios">lib.ios</a>)):</i>
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.ostream.cons">lib.ostream.cons</a> Constructor/destructor:</i>
    explicit basic_ostream(basic_streambuf&lt;char_type,traits&gt;* <i>sb</i>);
    <ins>basic_ostream(basic_ostream&amp;&amp; <i>rhs</i>);</ins>
    virtual ~basic_ostream();

    <ins>basic_ostream&amp; operator=(basic_ostream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_ostream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.ostream::sentry">lib.ostream::sentry</a> Prefix/suffix:</i>
    class sentry;

    //<i>  <a href="lib-iostreams.html#lib.ostream.formatted">lib.ostream.formatted</a> Formatted output:</i>
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;
        (basic_ostream&lt;charT,traits&gt;&amp; (*<i>pf</i>)(basic_ostream&lt;charT,traits&gt;&amp;));
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;
        (basic_ios&lt;charT,traits&gt;&amp; (*<i>pf</i>)(basic_ios&lt;charT,traits&gt;&amp;));
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;
        (ios_base&amp; (*<i>pf</i>)(ios_base&amp;));

    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(bool <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(short <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(unsigned short <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(int <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(unsigned int <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(long <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(unsigned long <i>n</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(float <i>f</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(double <i>f</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(long double <i>f</i>);

    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(const void* <i>p</i>);
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;
        (basic_streambuf&lt;char_type,traits&gt;* <i>sb</i>);

    //<i>  <a href="lib-iostreams.html#lib.ostream.unformatted">lib.ostream.unformatted</a> Unformatted output:</i>
    basic_ostream&lt;charT,traits&gt;&amp; put(char_type <i>c</i>);
    basic_ostream&lt;charT,traits&gt;&amp; write(const char_type* <i>s</i>, streamsize <i>n</i>);

    basic_ostream&lt;charT,traits&gt;&amp; flush();

    //<i>  <a href="lib-iostreams.html#lib.ostream.seeks">lib.ostream.seeks</a> seeks:</i>
    pos_type tellp();
    basic_ostream&lt;charT,traits&gt;&amp; seekp(pos_type);
    basic_ostream&lt;charT,traits&gt;&amp; seekp(off_type, ios_base::seekdir);
  };

  //<i>  <a href="lib-iostreams.html#lib.ostream.inserters.character">lib.ostream.inserters.character</a> character inserters</i>
  template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                          charT);
  <ins>template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                          charT);</ins>
  template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                          char);
  <ins>template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                          char);</ins>
  //<i>  specialization</i>
  template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                           char);
  <ins>template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           char);</ins>
  //<i>  signed and unsigned</i>
  template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                           signed char);
  <ins>template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           signed char);</ins>
  template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                           unsigned char);
  <ins>template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           unsigned char);</ins>

  template&lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                            const charT*);
  <ins>template&lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                            const charT*);</ins>
  template&lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                            const char*);
  <ins>template&lt;class charT, class traits&gt;
    basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                            const char*);</ins>
  //<i>  partial specializationss</i>
  template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           const char*);
  <ins>template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           const char*);</ins>
  //<i>   signed and unsigned</i>
  template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                           const signed char*);
  <ins>template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           const signed char*);</ins>
  template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                           const unsigned char*);
  <ins>template&lt;class traits&gt;
    basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                           const unsigned char*);</ins>

  <ins>template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;& x, basic_ostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;&& x, basic_ostream&lt;charT, traits&gt;& y);
  template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;& x, basic_ostream&lt;charT, traits&gt;&& y);</ins>
}
</pre></blockquote>

<h3><a name="27.6.2.2 - basic_ostream constructors"></a>27.6.2.2 - <tt>basic_ostream</tt> constructors</h3>

<blockquote><pre><ins>
basic_ostream(basic_ostream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by default constructing the base class and calling
<tt>basic_ios&lt;charT, traits&gt;::move(<i>rhs</i>)</tt> to initialize the base
class.
</ins></p>

<h3><a name="27.6.2.3 - basic_ostream member / non-member functions"></a><ins>27.6.2.3 - <tt>basic_ostream</tt> member / non-member functions</ins></h3>

<blockquote><pre><ins>
basic_ostream&amp; operator=(basic_ostream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-1- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-2- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_ostream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Calls <tt>basic_ios&lt;charT,
traits&gt;::swap(<i>rhs</i>)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;& <i>x</i>, basic_ostream&lt;charT, traits&gt;& <i>y</i>);
template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;&& <i>x</i>, basic_ostream&lt;charT, traits&gt;& <i>y</i>);
template &lt;class charT, class traits&gt;
    void swap(basic_ostream&lt;charT, traits&gt;& <i>x</i>, basic_ostream&lt;charT, traits&gt;&& <i>y</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> <tt><i>x</i>.swap(<i>y</i>)</tt>.
</ins></p>

<h3><a name="27.6.2.6.4 - Character inserter function templates"></a>27.6.2.<del>5</del><ins>6</ins>.4 - Character inserter function templates</h3>

<blockquote><pre>
template&lt;class charT, class traits&gt;
basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                        charT);
<ins>template&lt;class charT, class traits&gt;
basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                        charT);</ins>
template&lt;class charT, class traits&gt;
basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                        char);
<ins>template&lt;class charT, class traits&gt;
basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                        char);</ins>

template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                         char);
<ins>template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         char);</ins>

template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                         signed char);
<ins>template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         signed char);</ins>
template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                         unsigned char);
<ins>template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         unsigned char);</ins>

template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                          const charT*);
<ins>template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                          const charT*);</ins>
template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;,
                                          const char*);
<ins>template&lt;class charT, class traits&gt;
  basic_ostream&lt;charT,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;charT,traits&gt;&amp;&amp;,
                                          const char*);</ins>

template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         const char*);
<ins>template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         const char*);</ins>

template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                         const signed char*);
<ins>template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         const signed char*);</ins>
template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;,
                                         const unsigned char*);
<ins>template&lt;class traits&gt;
  basic_ostream&lt;char,traits&gt;&amp; operator&lt;&lt;(basic_ostream&lt;char,traits&gt;&amp;&amp;,
                                         const unsigned char*);</ins>
</pre></blockquote>

<h2><a name="27.7 - String-based streams"></a>27.7 - String-based streams</h2>

<blockquote class="note">
<p>
The four class templates in this section: <tt>basic_stringbuf</tt>,
<tt>basic_istringstream</tt>, <tt>basic_ostringstream</tt>, and
<tt>basic_stringstream</tt> are given a move constructor, move assignment
operator, and member and non-member <tt>swap</tt> functions. </p>
</blockquote>

<p>
<b>Header <tt>&lt;sstream&gt;</tt> synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
                    class Allocator = allocator&lt;charT&gt; &gt;
    class basic_stringbuf;

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringbuf&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>

  typedef basic_stringbuf&lt;char&gt;     stringbuf;
  typedef basic_stringbuf&lt;wchar_t&gt; wstringbuf;

  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
                    class Allocator = allocator&lt;charT&gt; &gt;
    class basic_istringstream;

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_istringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_istringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_istringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>

  typedef basic_istringstream&lt;char&gt;     istringstream;
  typedef basic_istringstream&lt;wchar_t&gt; wistringstream;

  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
                    class Allocator = allocator&lt;charT&gt; &gt;
    class basic_ostringstream;

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_ostringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>

  typedef basic_ostringstream&lt;char&gt;     ostringstream;
  typedef basic_ostringstream&lt;wchar_t&gt; wostringstream;

  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
                    class Allocator = allocator&lt;charT&gt; &gt;
    class basic_stringstream;

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_stringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>

  typedef basic_stringstream&lt;char&gt;     stringstream;
  typedef basic_stringstream&lt;wchar_t&gt; wstringstream;
}
</pre></blockquote>

<h3><a name="27.7.1 - Class template basic_stringbuf"></a>27.7.1 - Class template <tt>basic_stringbuf</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
            class Allocator = allocator&lt;charT&gt; &gt;
  class basic_stringbuf : public basic_streambuf&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.stringbuf.cons">lib.stringbuf.cons</a> Constructors:</i>
    explicit basic_stringbuf(ios_base::openmode <i>which</i>
                              = ios_base::in | ios_base::out);
    explicit basic_stringbuf
        (const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>str</i>,
         ios_base::openmode <i>which</i> = ios_base::in | ios_base::out);

    <ins>basic_stringbuf(basic_stringbuf&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_stringbuf&amp; operator=(basic_stringbuf&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_stringbuf&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.stringbuf.members">lib.stringbuf.members</a> Get and set:</i>
    basic_string&lt;charT,traits,Allocator&gt; str() const;
    void               str(const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>s</i>);

  protected:
    //<i>  <a href="lib-iostreams.html#lib.stringbuf.virtuals">lib.stringbuf.virtuals</a> Overridden virtual functions:</i>
    virtual int_type   underflow();
    virtual int_type   pbackfail(int_type <i>c</i> = traits::eof());
    virtual int_type   overflow (int_type <i>c</i> = traits::eof());
    virtual  basic_streambuf&lt;charT,traits&gt;* setbuf(charT*, streamsize);

    virtual pos_type   seekoff(off_type <i>off</i>, ios_base::seekdir <i>way</i>,
                               ios_base::openmode <i>which</i>
                                = ios_base::in | ios_base::out);
    virtual pos_type   seekpos(pos_type <i>sp</i>,
                               ios_base::openmode <i>which</i>
                                = ios_base::in | ios_base::out);

  private:
//  ios_base::openmode <i>mode</i>;       <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringbuf&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.7.1.1 - basic_stringbuf constructors"></a>27.7.1.1 - <tt>basic_stringbuf</tt> constructors</h4>

<blockquote><pre><ins>
basic_stringbuf(basic_stringbuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  It is
implementation defined whether the sequence pointers in <tt>*this</tt>
(<tt>eback()</tt>, <tt>gptr()</tt>, <tt>egptr()</tt>, <tt>pbase()</tt>,
<tt>pptr()</tt>, <tt>epptr()</tt>) obtain the values which <tt><i>rhs</i></tt>
had.  Whether they do or not, <tt>*this</tt> and <tt><i>rhs</i></tt> reference
separate buffers (if any at all) after the construction.  The openmode, locale
and any other state of <tt><i>rhs</i></tt> is also copied.
</ins></p>

<p><ins>
-5- <i>Postconditions:</i> Let <tt><i>rhs_p</i></tt> refer to the state of
<tt><i>rhs</i></tt> just prior to this construction and let
<tt><i>rhs_a</i></tt> refer to the state of <tt><i>rhs</i></tt> just after this
construction.
</ins></p>

<ul>
<li><ins><tt>str() == <i>rhs_p</i>.str()</tt></ins></li>
<li><ins><tt>gptr()  - eback() == <i>rhs_p</i>.gptr()  - <i>rhs_p</i>.eback()</tt></ins></li>
<li><ins><tt>egptr() - eback() == <i>rhs_p</i>.egptr() - <i>rhs_p</i>.eback()</tt></ins></li>
<li><ins><tt>pptr()  - pbase() == <i>rhs_p</i>.pptr()  - <i>rhs_p</i>.pbase()</tt></ins></li>
<li><ins><tt>epptr() - pbase() == <i>rhs_p</i>.epptr() - <i>rhs_p</i>.pbase()</tt></ins></li>
<li><ins><tt>if (eback()) eback() != <i>rhs_a</i>.eback()</tt></ins></li>
<li><ins><tt>if (gptr())  gptr()  != <i>rhs_a</i>.gptr()</tt></ins></li>
<li><ins><tt>if (egptr()) egptr() != <i>rhs_a</i>.egptr()</tt></ins></li>
<li><ins><tt>if (pbase()) pbase() != <i>rhs_a</i>.pbase()</tt></ins></li>
<li><ins><tt>if (pptr())  pptr()  != <i>rhs_a</i>.pptr()</tt></ins></li>
<li><ins><tt>if (epptr()) epptr() != <i>rhs_a</i>.epptr()</tt></ins></li>
</ul>

<h4><a name="27.7.1.2 - Member / non-member functions"></a>27.7.1.2 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_stringbuf&amp; operator=(basic_stringbuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-4- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_stringbuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-5- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; x,
     basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp;&amp; x,
     basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_stringbuf&lt;charT, traits, Allocator&gt;&amp; x,
     basic_stringbuf&lt;charT, traits, Allocator&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-6- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h3><a name="27.7.2 - Class template basic_istringstream"></a>27.7.2 - Class template <tt>basic_istringstream</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
	    class Allocator = allocator&lt;charT&gt; &gt;
  class basic_istringstream : public basic_istream&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.istringstream.cons">lib.istringstream.cons</a> Constructors:</i>
    explicit basic_istringstream(ios_base::openmode <i>which</i> = ios_base::in);
    explicit basic_istringstream(
		       const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>str</i>,
		       ios_base::openmode <i>which</i> = ios_base::in);

    <ins>basic_istringstream(basic_istringstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_istringstream&amp; operator=(basic_istringstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_istringstream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.istringstream.members">lib.istringstream.members</a> Members:</i>
    basic_stringbuf&lt;charT,traits,Allocator&gt;* rdbuf() const;

    basic_string&lt;charT,traits,Allocator&gt; str() const;
    void str(const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>s</i>);
private:
//  basic_stringbuf&lt;charT,traits,Allocator&gt; <i>sb</i>;   <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_istringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_istringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_istringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.7.2.1 - basic_istringstream constructors"></a>27.7.2.1 - <tt>basic_istringstream</tt> constructors</h4>

<blockquote><pre><ins>
basic_istringstream(basic_istringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by move constructing the base class, and the contained
<tt>basic_stringbuf</tt>. Next
<tt>basic_istream&lt;charT,traits&gt;::set_rdbuf(&amp;sb)</tt> is called to
install the contained <tt>basic_stringbuf</tt>.
</ins></p>

<h4><a name="27.7.2.2 - Member / non-member functions"></a>27.7.2.2 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_istringstream&amp; operator=(basic_istringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-5- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_istringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-6- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt> by calling
<tt>basic_istream&lt;charT,traits&gt;::swap(rhs)</tt> and
<tt>sb.swap(rhs.sb)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp; x,
     basic_istringstream&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
     basic_istringstream&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_istringstream&lt;charT, traits, Allocator&gt;&amp; x,
     basic_istringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-7- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h3><a name="27.7.3 - Class template basic_ostringstream"></a>27.7.3 - Class template <tt>basic_ostringstream</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
	    class Allocator = allocator&lt;charT&gt; &gt;
  class basic_ostringstream : public basic_istream&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.ostringstream.cons">lib.ostringstream.cons</a> Constructors:</i>
    explicit basic_ostringstream(ios_base::openmode <i>which</i> = ios_base::out);
    explicit basic_ostringstream(
		       const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>str</i>,
		       ios_base::openmode <i>which</i> = ios_base::out);

    <ins>basic_ostringstream(basic_ostringstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_ostringstream&amp; operator=(basic_ostringstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_ostringstream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.ostringstream.members">lib.ostringstream.members</a> Members:</i>
    basic_stringbuf&lt;charT,traits,Allocator&gt;* rdbuf() const;

    basic_string&lt;charT,traits,Allocator&gt; str() const;
    void str(const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>s</i>);
private:
//  basic_stringbuf&lt;charT,traits,Allocator&gt; <i>sb</i>;   <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_ostringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.7.3.1 - basic_ostringstream constructors"></a>27.7.3.1 - <tt>basic_ostringstream</tt> constructors</h4>

<blockquote><pre><ins>
basic_ostringstream(basic_ostringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by move constructing the base class, and the contained
<tt>basic_stringbuf</tt>. Next
<tt>basic_ostream&lt;charT,traits&gt;::set_rdbuf(&amp;sb)</tt> is called to
install the contained <tt>basic_stringbuf</tt>.
</ins></p>

<h4><a name="27.7.3.2 - Member / non-member functions"></a>27.7.3.2 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_ostringstream&amp; operator=(basic_ostringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-5- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_ostringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-6- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt> by calling
<tt>basic_ostream&lt;charT,traits&gt;::swap(rhs)</tt> and
<tt>sb.swap(rhs.sb)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; x,
     basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
     basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_ostringstream&lt;charT, traits, Allocator&gt;&amp; x,
     basic_ostringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-7- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h3><a name="27.7.4 - Class template basic_stringstream"></a>27.7.4 - Class template <tt>basic_stringstream</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt;,
	    class Allocator = allocator&lt;charT&gt; &gt;
  class basic_stringstream : public basic_istream&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.stringstream.cons">lib.stringstream.cons</a> Constructors:</i>
    explicit basic_stringstream(ios_base::openmode <i>which</i> = ios_base::out | ios_base::in);
    explicit basic_stringstream(
		       const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>str</i>,
		       ios_base::openmode <i>which</i> = ios_base::out | ios_base::in);

    <ins>basic_stringstream(basic_stringstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_stringstream&amp; operator=(basic_stringstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_stringstream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.stringstream.members">lib.stringstream.members</a> Members:</i>
    basic_stringbuf&lt;charT,traits,Allocator&gt;* rdbuf() const;

    basic_string&lt;charT,traits,Allocator&gt; str() const;
    void str(const basic_string&lt;charT,traits,Allocator&gt;&amp; <i>s</i>);
private:
//  basic_stringbuf&lt;charT,traits,Allocator&gt; <i>sb</i>;   <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
       basic_stringstream&lt;charT, traits, Allocator&gt;&amp; y);

  template &lt;class charT, class traits, class Allocator&gt;
  void
  swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp; x,
       basic_stringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.7.5 - basic_stringstream constructors"></a>27.7.5 - <tt>basic_stringstream</tt> constructors</h4>

<blockquote><pre><ins>
basic_stringstream(basic_stringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by move constructing the base class, and the contained
<tt>basic_stringbuf</tt>. Next
<tt>basic_istream&lt;charT,traits&gt;::set_rdbuf(&amp;sb)</tt> is called to
install the contained <tt>basic_stringbuf</tt>.
</ins></p>

<h4><a name="27.7.6 - Member / non-member functions"></a>27.7.6 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_stringstream&amp; operator=(basic_stringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-5- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_stringstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-6- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt> by calling
<tt>basic_iostream&lt;charT,traits&gt;::swap(rhs)</tt> and
<tt>sb.swap(rhs.sb)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp; x,
     basic_stringstream&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp;&amp; x,
     basic_stringstream&lt;charT, traits, Allocator&gt;&amp; y);

template &lt;class charT, class traits, class Allocator&gt;
void
swap(basic_stringstream&lt;charT, traits, Allocator&gt;&amp; x,
     basic_stringstream&lt;charT, traits, Allocator&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-7- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h2><a name="27.8.1 - File streams"></a>27.8.1 - File streams</h2>

<blockquote class="note">
<p>
The four class templates in this section: <tt>basic_filebuf</tt>,
<tt>basic_ifstream</tt>, <tt>basic_ofstream</tt>, and <tt>basic_fstream</tt> are
given a move constructor, move assignment operator, and member and non-member
<tt>swap</tt> functions. </p>
</blockquote>

<p>
<b>Header <tt>&lt;fstream&gt;</tt> synopsis</b>
</p>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_filebuf;

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_filebuf&lt;charT, traits&gt;&amp; x,
       basic_filebuf&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_filebuf&lt;charT, traits&gt;&amp;&amp; x,
       basic_filebuf&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_filebuf&lt;charT, traits&gt;&amp; x,
       basic_filebuf&lt;charT, traits&gt;&amp;&amp; y);</ins>

  typedef basic_filebuf&lt;char&gt;    filebuf;
  typedef basic_filebuf&lt;wchar_t&gt; wfilebuf;

  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_ifstream;

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_ifstream&lt;charT, traits&gt;&amp; x,
       basic_ifstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ifstream&lt;charT, traits&gt;&amp;&amp; x,
       basic_ifstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ifstream&lt;charT, traits&gt;&amp; x,
       basic_ifstream&lt;charT, traits&gt;&amp;&amp; y);</ins>

  typedef basic_ifstream&lt;char&gt;    ifstream;
  typedef basic_ifstream&lt;wchar_t&gt; wifstream;

  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_ofstream;

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_ofstream&lt;charT, traits&gt;&amp; x,
       basic_ofstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ofstream&lt;charT, traits&gt;&amp;&amp; x,
       basic_ofstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ofstream&lt;charT, traits&gt;&amp; x,
       basic_ofstream&lt;charT, traits&gt;&amp;&amp; y);</ins>

  typedef basic_ofstream&lt;char&gt;    ofstream;
  typedef basic_ofstream&lt;wchar_t&gt; wofstream;

  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
    class basic_fstream;

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_fstream&lt;charT, traits&gt;&amp; x,
       basic_fstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_fstream&lt;charT, traits&gt;&amp;&amp; x,
       basic_fstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_fstream&lt;charT, traits&gt;&amp; x,
       basic_fstream&lt;charT, traits&gt;&amp;&amp; y);</ins>

  typedef basic_fstream&lt;char&gt;    fstream;
  typedef basic_fstream&lt;wchar_t&gt; wfstream;
}
</pre></blockquote>

<h3><a name="27.8.1.1 - Class template basic_filebuf"></a>27.8.1.1 - Class template <tt>basic_filebuf</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_filebuf : public basic_streambuf&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.filebuf.cons">lib.filebuf.cons</a> Constructors/destructor:</i>
    basic_filebuf();
    virtual ~basic_filebuf();

    <ins>basic_filebuf(basic_filebuf&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_filebuf&amp; operator=(basic_filebuf&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_filebuf&amp;&amp; <i>rhs</i>);</ins>

     //<i>  <a href="lib-iostreams.html#lib.filebuf.members">lib.filebuf.members</a> Members:</i>
    bool is_open() const;
    basic_filebuf&lt;charT,traits&gt;* open
	(const char* <i>s</i>, ios_base::openmode <i>mode</i>);
    basic_filebuf&lt;charT,traits&gt;* close();

  protected:
    //<i>  <a href="lib-iostreams.html#lib.filebuf.virtuals">lib.filebuf.virtuals</a> Overridden virtual functions:</i>
    virtual streamsize showmanyc();
    virtual int_type underflow();
    virtual int_type uflow();
    virtual int_type pbackfail(int_type <i>c</i> = traits::eof());
    virtual int_type overflow (int_type <i>c</i> = traits::eof());

    virtual basic_streambuf&lt;charT,traits&gt;*
		     setbuf(char_type* <i>s</i>, streamsize <i>n</i>);
    virtual pos_type seekoff(off_type <i>off</i>, ios_base::seekdir <i>way</i>,
			     ios_base::openmode <i>which</i>
			       = ios_base::in | ios_base::out);
    virtual pos_type seekpos(pos_type <i>sp</i>, ios_base::openmode <i>which</i>
			       = ios_base::in | ios_base::out);
    virtual int      sync();
    virtual void     imbue(const locale&amp; <i>loc</i>);
  };

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_filebuf&lt;charT, traits&gt;&amp; x,
       basic_filebuf&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_filebuf&lt;charT, traits&gt;&amp;&amp; x,
       basic_filebuf&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_filebuf&lt;charT, traits&gt;&amp; x,
       basic_filebuf&lt;charT, traits&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.8.1.2 - basic_filebuf constructors"></a>27.8.1.2 - <tt>basic_filebuf</tt> constructors</h4>

<blockquote><pre><ins>
basic_filebuf(basic_filebuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-4- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  It is
implementation defined whether the sequence pointers in <tt>*this</tt>
(<tt>eback()</tt>, <tt>gptr()</tt>, <tt>egptr()</tt>, <tt>pbase()</tt>,
<tt>pptr()</tt>, <tt>epptr()</tt>) obtain the values which <tt><i>rhs</i></tt>
had.  Whether they do or not, <tt>*this</tt> and <tt><i>rhs</i></tt> reference
separate buffers (if any at all) after the construction.  Additionally
<tt>*this</tt> references the file which <tt><i>rhs</i></tt> did before the
construction, and <tt><i>rhs</i></tt> references no file after the construction.
 The openmode, locale and any other state of <tt><i>rhs</i></tt> is also copied.
</ins></p>

<p><ins>
-5- <i>Postconditions:</i> Let <tt><i>rhs_p</i></tt> refer to the state of
<tt><i>rhs</i></tt> just prior to this construction and let
<tt><i>rhs_a</i></tt> refer to the state of <tt><i>rhs</i></tt> just after this
construction.
</ins></p>

<ul>
<li><ins><tt>is_open() == <i>rhs_p</i>.is_open()</tt></ins></li>
<li><ins><tt><i>rhs_a</i>.is_open() == false</tt></ins></li>
<li><ins><tt>gptr()  - eback() == <i>rhs_p</i>.gptr()  - <i>rhs_p</i>.eback()</tt></ins></li>
<li><ins><tt>egptr() - eback() == <i>rhs_p</i>.egptr() - <i>rhs_p</i>.eback()</tt></ins></li>
<li><ins><tt>pptr()  - pbase() == <i>rhs_p</i>.pptr()  - <i>rhs_p</i>.pbase()</tt></ins></li>
<li><ins><tt>epptr() - pbase() == <i>rhs_p</i>.epptr() - <i>rhs_p</i>.pbase()</tt></ins></li>
<li><ins><tt>if (eback()) eback() != <i>rhs_a</i>.eback()</tt></ins></li>
<li><ins><tt>if (gptr())  gptr()  != <i>rhs_a</i>.gptr()</tt></ins></li>
<li><ins><tt>if (egptr()) egptr() != <i>rhs_a</i>.egptr()</tt></ins></li>
<li><ins><tt>if (pbase()) pbase() != <i>rhs_a</i>.pbase()</tt></ins></li>
<li><ins><tt>if (pptr())  pptr()  != <i>rhs_a</i>.pptr()</tt></ins></li>
<li><ins><tt>if (epptr()) epptr() != <i>rhs_a</i>.epptr()</tt></ins></li>
</ul>

<h4><a name="27.8.1.3 - Member / non-member functions"></a>27.8.1.3 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_filebuf&amp; operator=(basic_filebuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-9- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-10- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_filebuf&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-11- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
void
swap(basic_filebuf&lt;charT, traits&gt;&amp; x,
     basic_filebuf&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_filebuf&lt;charT, traits&gt;&amp;&amp; x,
     basic_filebuf&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_filebuf&lt;charT, traits&gt;&amp; x,
     basic_filebuf&lt;charT, traits&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-12- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h3><a name="27.8.1.5 - Class template basic_ifstream"></a>27.8.1.5 - Class template <tt>basic_ifstream</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_ifstream : public basic_istream&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.ifstream.cons">lib.ifstream.cons</a> Constructors:</i>
    basic_ifstream();
    explicit basic_ifstream(const char* <i>s</i>,
			    ios_base::openmode <i>mode</i> = ios_base::in);

    <ins>basic_ifstream(basic_ifstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_ifstream&amp; operator=(basic_ifstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_ifstream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.ifstream.members">lib.ifstream.members</a> Members:</i>
    basic_filebuf&lt;charT,traits&gt;* rdbuf() const;

    bool is_open();
    void open(const char* <i>s</i>, ios_base::openmode <i>mode</i> = ios_base::in);
    void close();
  private:
//  basic_filebuf&lt;charT,traits&gt; <i>sb</i>;       <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_ifstream&lt;charT, traits&gt;&amp; x,
       basic_ifstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ifstream&lt;charT, traits&gt;&amp;&amp; x,
       basic_ifstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ifstream&lt;charT, traits&gt;&amp; x,
       basic_ifstream&lt;charT, traits&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.8.1.6 - basic_ifstream constructors"></a>27.8.1.6 - <tt>basic_ifstream</tt> constructors</h4>

<blockquote><pre><ins>
basic_ifstream(basic_ifstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by move constructing the base class, and the contained
<tt>basic_filebuf</tt>. Next
<tt>basic_istream&lt;charT,traits&gt;::set_rdbuf(&amp;sb)</tt> is called to
install the contained <tt>basic_filebuf</tt>.
</ins></p>

<h4><a name="27.8.1.7 - Member / non-member functions"></a>27.8.1.7 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_ifstream&amp; operator=(basic_ifstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-5- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-6- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_ifstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-7- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt> by calling
<tt>basic_istream&lt;charT,traits&gt;::swap(rhs)</tt> and
<tt>sb.swap(rhs.sb)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
void
swap(basic_ifstream&lt;charT, traits&gt;&amp; x,
     basic_ifstream&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_ifstream&lt;charT, traits&gt;&amp;&amp; x,
     basic_ifstream&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_ifstream&lt;charT, traits&gt;&amp; x,
     basic_ifstream&lt;charT, traits&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-8- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h3><a name="27.8.1.8 - Class template basic_ofstream"></a>27.8.1.8 - Class template <tt>basic_ofstream</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_ofstream : public basic_istream&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.ifstream.cons">lib.ifstream.cons</a> Constructors:</i>
    basic_ofstream();
    explicit basic_ofstream(const char* <i>s</i>,
			    ios_base::openmode <i>mode</i> = ios_base::out);

    <ins>basic_ofstream(basic_ofstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_ofstream&amp; operator=(basic_ofstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_ofstream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.ofstream.members">lib.ofstream.members</a> Members:</i>
    basic_filebuf&lt;charT,traits&gt;* rdbuf() const;

    bool is_open();
    void open(const char* <i>s</i>, ios_base::openmode <i>mode</i> = ios_base::out);
    void close();
  private:
//  basic_filebuf&lt;charT,traits&gt; <i>sb</i>;       <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_ofstream&lt;charT, traits&gt;&amp; x,
       basic_ofstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ofstream&lt;charT, traits&gt;&amp;&amp; x,
       basic_ofstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_ofstream&lt;charT, traits&gt;&amp; x,
       basic_ofstream&lt;charT, traits&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.8.1.9 - basic_ofstream constructors"></a>27.8.1.9 - <tt>basic_ofstream</tt> constructors</h4>

<blockquote><pre><ins>
basic_ofstream(basic_ofstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by move constructing the base class, and the contained
<tt>basic_filebuf</tt>. Next
<tt>basic_ostream&lt;charT,traits&gt;::set_rdbuf(&amp;sb)</tt> is called to
install the contained <tt>basic_filebuf</tt>.
</ins></p>

<h4><a name="27.8.1.10 - Member / non-member functions"></a>27.8.1.10 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_ofstream&amp; operator=(basic_ofstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-5- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-6- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_ofstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-7- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt> by calling
<tt>basic_ostream&lt;charT,traits&gt;::swap(rhs)</tt> and
<tt>sb.swap(rhs.sb)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
void
swap(basic_ofstream&lt;charT, traits&gt;&amp; x,
     basic_ofstream&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_ofstream&lt;charT, traits&gt;&amp;&amp; x,
     basic_ofstream&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_ofstream&lt;charT, traits&gt;&amp; x,
     basic_ofstream&lt;charT, traits&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-8- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

<h3><a name="27.8.1.11 - Class template basic_fstream"></a>27.8.1.11 - Class template <tt>basic_fstream</tt></h3>

<blockquote><pre>
namespace std {
  template &lt;class charT, class traits = char_traits&lt;charT&gt; &gt;
  class basic_fstream : public basic_istream&lt;charT,traits&gt; {
  public:
    typedef charT                     char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits                    traits_type;

    //<i>  <a href="lib-iostreams.html#lib.ifstream.cons">lib.ifstream.cons</a> Constructors:</i>
    basic_fstream();
    explicit basic_fstream(const char* <i>s</i>,
			    ios_base::openmode <i>mode</i> = ios_base::in | ios_base::out);

    <ins>basic_fstream(basic_fstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>basic_fstream&amp; operator=(basic_fstream&amp;&amp; <i>rhs</i>);</ins>
    <ins>void swap(basic_fstream&amp;&amp; <i>rhs</i>);</ins>

    //<i>  <a href="lib-iostreams.html#lib.ifstream.members">lib.ifstream.members</a> Members:</i>
    basic_filebuf&lt;charT,traits&gt;* rdbuf() const;

    bool is_open();
    void open(const char* <i>s</i>, ios_base::openmode <i>mode</i> = ios_base::in | ios_base::out);
    void close();
  private:
//  basic_filebuf&lt;charT,traits&gt; <i>sb</i>;       <i><b>exposition only</b></i>
  };

  <ins>template &lt;class charT, class traits&gt;
  void
  swap(basic_fstream&lt;charT, traits&gt;&amp; x,
       basic_fstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_fstream&lt;charT, traits&gt;&amp;&amp; x,
       basic_fstream&lt;charT, traits&gt;&amp; y);

  template &lt;class charT, class traits&gt;
  void
  swap(basic_fstream&lt;charT, traits&gt;&amp; x,
       basic_fstream&lt;charT, traits&gt;&amp;&amp; y);</ins>
}
</pre></blockquote>

<h4><a name="27.8.1.12 - basic_fstream constructors"></a>27.8.1.12 - <tt>basic_fstream</tt> constructors</h4>

<blockquote><pre><ins>
basic_fstream(basic_fstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-3- <i>Effects:</i> Move constructs from the rvalue <tt><i>rhs</i></tt>.  This
is accomplished by move constructing the base class, and the contained
<tt>basic_filebuf</tt>. Next
<tt>basic_istream&lt;charT,traits&gt;::set_rdbuf(&amp;sb)</tt> is called to
install the contained <tt>basic_filebuf</tt>.
</ins></p>

<h4><a name="27.8.1.13 - Member / non-member functions"></a>27.8.1.13 - Member <ins>/ non-member</ins> functions</h4>

<blockquote><pre><ins>
basic_fstream&amp; operator=(basic_fstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-5- <i>Effects:</i> <tt>swap(<i>rhs</i>)</tt>.
</ins></p>

<p><ins>
-6- <i>Returns:</i> <tt>*this</tt>.
</ins></p>

<blockquote><pre><ins>
void swap(basic_fstream&amp;&amp; <i>rhs</i>);
</ins></pre></blockquote>

<p><ins>
-7- <i>Effects:</i> Exchanges the state of <tt>*this</tt> and
<tt><i>rhs</i></tt> by calling
<tt>basic_iostream&lt;charT,traits&gt;::swap(rhs)</tt> and
<tt>sb.swap(rhs.sb)</tt>.
</ins></p>

<blockquote><pre><ins>
template &lt;class charT, class traits&gt;
void
swap(basic_fstream&lt;charT, traits&gt;&amp; x,
     basic_fstream&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_fstream&lt;charT, traits&gt;&amp;&amp; x,
     basic_fstream&lt;charT, traits&gt;&amp; y);

template &lt;class charT, class traits&gt;
void
swap(basic_fstream&lt;charT, traits&gt;&amp; x,
     basic_fstream&lt;charT, traits&gt;&amp;&amp; y);
</ins></pre></blockquote>

<p><ins>
-8- <i>Effects:</i> <tt>x.swap(y)</tt>.
</ins></p>

</body>
</html>
