<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[cannot bind &#x27;std::basic_ostream&amp;lt;char&amp;gt;&#x27; lvalue to &#x27;std::basic_ostream&amp;lt;char&amp;gt;&amp;amp;&amp;amp;&#x27;|]]></title><description><![CDATA[<p>Wenn ich dieses einfache Beispiel kompiliere, bekomme ich folgenden Fehler:</p>
<pre><code>#include &quot;../rapidxml/rapidxml.hpp&quot;
#include &lt;fstream&gt;

int main()
{
    rapidxml::xml_document&lt;&gt; doc;
    std::ofstream file(&quot;text.xml&quot;);
    file &lt;&lt; doc;
}
</code></pre>
<blockquote>
<p>||=== Build: Debug in sample (compiler: GNU GCC Compiler) ===|<br />
/src/main.cpp||In function 'int main()':|<br />
/src/main.cpp|8|error: cannot bind 'std::basic_ostream&lt;char&gt;' lvalue to 'std::basic_ostream&lt;char&gt;&amp;&amp;'|<br />
/usr/include/c++/4.9.2/ostream|602|note: initializing argument 1 of 'std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::operator&lt;&lt;(std::basic_ostream&lt;_CharT, _Traits&gt;&amp;&amp;, const _Tp&amp;) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; _Tp = rapidxml::xml_document&lt;char&gt;]'|<br />
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|</p>
</blockquote>
<p>Codeblocks zeigt auf diesen Teil von ostream:</p>
<pre><code>#if __cplusplus &gt;= 201103L
  /**
   *  @brief  Generic inserter for rvalue stream
   *  @param  __os  An input stream.
   *  @param  __x  A reference to the object being inserted.
   *  @return  os
   *
   *  This is just a forwarding function to allow insertion to
   *  rvalue streams since they won't bind to the inserter functions
   *  that take an lvalue reference.
  */
  template&lt;typename _CharT, typename _Traits, typename _Tp&gt;
    inline basic_ostream&lt;_CharT, _Traits&gt;&amp;
-&gt;    operator&lt;&lt;(basic_ostream&lt;_CharT, _Traits&gt;&amp;&amp; __os, const _Tp&amp; __x)
    { return (__os &lt;&lt; __x); }
#endif // C++11
</code></pre>
<p>Ich verstehe den Fehler nicht, in jedem Beispiel von RapidXml wird das Dokument so gespeichert. Kann doc nicht in eine rvalue umgewandelt werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/331095/cannot-bind-std-basic_ostream-lt-char-gt-lvalue-to-std-basic_ostream-lt-char-gt-amp-amp</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 21:01:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/331095.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Feb 2015 14:53:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to cannot bind &#x27;std::basic_ostream&amp;lt;char&amp;gt;&#x27; lvalue to &#x27;std::basic_ostream&amp;lt;char&amp;gt;&amp;amp;&amp;amp;&#x27;| on Tue, 10 Feb 2015 14:53:26 GMT]]></title><description><![CDATA[<p>Wenn ich dieses einfache Beispiel kompiliere, bekomme ich folgenden Fehler:</p>
<pre><code>#include &quot;../rapidxml/rapidxml.hpp&quot;
#include &lt;fstream&gt;

int main()
{
    rapidxml::xml_document&lt;&gt; doc;
    std::ofstream file(&quot;text.xml&quot;);
    file &lt;&lt; doc;
}
</code></pre>
<blockquote>
<p>||=== Build: Debug in sample (compiler: GNU GCC Compiler) ===|<br />
/src/main.cpp||In function 'int main()':|<br />
/src/main.cpp|8|error: cannot bind 'std::basic_ostream&lt;char&gt;' lvalue to 'std::basic_ostream&lt;char&gt;&amp;&amp;'|<br />
/usr/include/c++/4.9.2/ostream|602|note: initializing argument 1 of 'std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::operator&lt;&lt;(std::basic_ostream&lt;_CharT, _Traits&gt;&amp;&amp;, const _Tp&amp;) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;; _Tp = rapidxml::xml_document&lt;char&gt;]'|<br />
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|</p>
</blockquote>
<p>Codeblocks zeigt auf diesen Teil von ostream:</p>
<pre><code>#if __cplusplus &gt;= 201103L
  /**
   *  @brief  Generic inserter for rvalue stream
   *  @param  __os  An input stream.
   *  @param  __x  A reference to the object being inserted.
   *  @return  os
   *
   *  This is just a forwarding function to allow insertion to
   *  rvalue streams since they won't bind to the inserter functions
   *  that take an lvalue reference.
  */
  template&lt;typename _CharT, typename _Traits, typename _Tp&gt;
    inline basic_ostream&lt;_CharT, _Traits&gt;&amp;
-&gt;    operator&lt;&lt;(basic_ostream&lt;_CharT, _Traits&gt;&amp;&amp; __os, const _Tp&amp; __x)
    { return (__os &lt;&lt; __x); }
#endif // C++11
</code></pre>
<p>Ich verstehe den Fehler nicht, in jedem Beispiel von RapidXml wird das Dokument so gespeichert. Kann doc nicht in eine rvalue umgewandelt werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2442140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2442140</guid><dc:creator><![CDATA[RapidXml]]></dc:creator><pubDate>Tue, 10 Feb 2015 14:53:26 GMT</pubDate></item><item><title><![CDATA[Reply to cannot bind &#x27;std::basic_ostream&amp;lt;char&amp;gt;&#x27; lvalue to &#x27;std::basic_ostream&amp;lt;char&amp;gt;&amp;amp;&amp;amp;&#x27;| on Tue, 10 Feb 2015 14:58:10 GMT]]></title><description><![CDATA[<blockquote>
<p>Use print() function or operator &lt;&lt;, which are defined in rapidxml_print.hpp header.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2442141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2442141</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Tue, 10 Feb 2015 14:58:10 GMT</pubDate></item></channel></rss>