<?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[RValue-Reference in VC 2010]]></title><description><![CDATA[<p>Hallo</p>
<p>dieses Stück Code kompiliert mit VC 2010 nicht, mit GCC 4.5 schon.</p>
<pre><code class="language-cpp">template&lt;typename T&gt;
struct S
{};

template&lt;typename T&gt;
struct S&lt;T&amp;&gt;
{};

template&lt;typename T&gt;
struct S&lt;T&amp;&amp;&gt;
{};

template&lt;typename T&gt;
void t(T&amp;&amp;)
{
	S&lt;T&amp;&amp;&gt; s;
}

int main()
{
	t(main);
}
</code></pre>
<pre><code>1&gt;main.cpp(16): error C2752: 'S&lt;T&gt;' : more than one partial specialization matches the template argument list
1&gt;          with
1&gt;          [
1&gt;              T=int (__cdecl &amp;)(void)
1&gt;          ]
1&gt;          main.cpp(11): could be 'S&lt;T&amp;&amp;&gt;'
1&gt;          main.cpp(7): or       'S&lt;T&amp;&gt;'
1&gt;          main.cpp(21) : see reference to function template instantiation 'void t&lt;int(__cdecl &amp;)(void)&gt;(T)' being compiled
1&gt;          with
1&gt;          [
1&gt;              T=int (__cdecl &amp;)(void)
1&gt;          ]
1&gt;
1&gt;Build FAILED.
</code></pre>
<p>Ist VC hier falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/267949/rvalue-reference-in-vc-2010</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 04:03:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267949.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Jun 2010 18:15:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Tue, 01 Jun 2010 18:15:41 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>dieses Stück Code kompiliert mit VC 2010 nicht, mit GCC 4.5 schon.</p>
<pre><code class="language-cpp">template&lt;typename T&gt;
struct S
{};

template&lt;typename T&gt;
struct S&lt;T&amp;&gt;
{};

template&lt;typename T&gt;
struct S&lt;T&amp;&amp;&gt;
{};

template&lt;typename T&gt;
void t(T&amp;&amp;)
{
	S&lt;T&amp;&amp;&gt; s;
}

int main()
{
	t(main);
}
</code></pre>
<pre><code>1&gt;main.cpp(16): error C2752: 'S&lt;T&gt;' : more than one partial specialization matches the template argument list
1&gt;          with
1&gt;          [
1&gt;              T=int (__cdecl &amp;)(void)
1&gt;          ]
1&gt;          main.cpp(11): could be 'S&lt;T&amp;&amp;&gt;'
1&gt;          main.cpp(7): or       'S&lt;T&amp;&gt;'
1&gt;          main.cpp(21) : see reference to function template instantiation 'void t&lt;int(__cdecl &amp;)(void)&gt;(T)' being compiled
1&gt;          with
1&gt;          [
1&gt;              T=int (__cdecl &amp;)(void)
1&gt;          ]
1&gt;
1&gt;Build FAILED.
</code></pre>
<p>Ist VC hier falsch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905611</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905611</guid><dc:creator><![CDATA[Reference]]></dc:creator><pubDate>Tue, 01 Jun 2010 18:15:41 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 11:47:05 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;typename T&gt; struct S&lt;T&amp;&gt;
</code></pre>
<p>ist in meinen Augen spezieller als</p>
<pre><code class="language-cpp">template&lt;typename T&gt; struct S&lt;T&amp;&amp;&gt;
</code></pre>
<p>so dass hier keine Mehrdeutigkeit vorliegen dürfte. Möglicherwiese kommt VC nicht formal mit Funktionsrvalues zurecht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905854</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 02 Jun 2010 11:47:05 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 12:04:08 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<pre><code class="language-cpp">template&lt;typename T&gt; struct S&lt;T&amp;&gt;
</code></pre>
<p>ist in meinen Augen spezieller als</p>
<pre><code class="language-cpp">template&lt;typename T&gt; struct S&lt;T&amp;&amp;&gt;
</code></pre>
<p>so dass hier keine Mehrdeutigkeit vorliegen dürfte. Möglicherwiese kommt VC nicht formal mit Funktionsrvalues zurecht.</p>
</blockquote>
<p>Wenn das erste &quot;spezieller&quot; sein soll, klingt das so, als wäre es ein Spezialfall des Zweiten. Aber spätestens seit einem Jahr (&quot;Rvalue references version 2.0&quot;) haben diese beiden Referenz-Typen nicht viel gemein:</p>
<pre><code class="language-cpp">int i = 23;
int &amp;  r1 = i;   // OK
int &amp;&amp; r2 = i;   // ill-formed

int &amp;  r3 = i+1; // ill-formed
int &amp;&amp; r4 = i+1; // OK
</code></pre>
<p>Konnte man vorher &amp;&amp; noch als alles-bindende Referenz verstehen, trifft dies nicht mehr zu. eine Rvalue-Referenz lässt sich jetzt <strong>nur</strong> noch mit Rvalues initialisieren. Eine kompakte tabellarische Übersicht bzgl Initialisierung von Referenzen gibt es <a href="http://cpp-next.com/archive/2009/09/move-it-with-rvalue-references/" rel="nofollow">hier</a>. Der GCC (zumindest bis Version 4.4) akzeptiert die Initialisierung von r2 noch. Das ist aber nicht mehr im Sinne des kommenden Standards.</p>
<p>Für mich sieht das Verhalten des Microsoft Compilers bei diesem Stück Code nach einem Bug aus.</p>
<p>kk</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905862</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905862</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 02 Jun 2010 12:04:08 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 12:10:53 GMT]]></title><description><![CDATA[<p>Upps, ich seh ja jetzt erst, dass es sich hier um Funktions-Referenzen handelt. Da kann ich spontan nicht viel zu sagen. Ich denke, Funktionen werden als lvalues behandelt. Bin mir aber nicht sicher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905865</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905865</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 02 Jun 2010 12:10:53 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 12:46:52 GMT]]></title><description><![CDATA[<p>Ihr redet ja so, ob der neue Standard schon aktuell sei <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905880</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905880</guid><dc:creator><![CDATA[Zeus]]></dc:creator><pubDate>Wed, 02 Jun 2010 12:46:52 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 13:06:34 GMT]]></title><description><![CDATA[<p>Zeus schrieb:</p>
<blockquote>
<p>Ihr redet ja so, ob der neue Standard schon aktuell sei <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
</blockquote>
<p>Naja, es gibt ja einen aktuellen Entwurf, den man sich herunterladen kann. Und viel wird darin wohl nicht mehr verändert werden. Wenn ich mich recht erinnere gibt es nur noch 1-2 Konferenzen und danach wird es der ISO zur Standardisierung übergeben, was dann nochmals ein halbes bis ganzes Jahr dauern dürfte. Der Standard ist somit fast fertig. Oder wie man dies immer so schön sagt: Soon<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/2122.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--trade_mark"
      title=":trade_mark:"
      alt="™"
    />.</p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905893</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905893</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Wed, 02 Jun 2010 13:06:34 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 14:40:29 GMT]]></title><description><![CDATA[<p>krümelkacker schrieb:</p>
<blockquote>
<p>Wenn das erste &quot;spezieller&quot; sein soll, klingt das so, als wäre es ein Spezialfall des Zweiten.</p>
</blockquote>
<p>Spezieller im Sinne von 14.5.5.2 des aktuellen Entwurfs in Hinblick auf die partielle Ordnung von Templatespezialisierungen.</p>
<p>Dank der Kombinationsregel in 8.3.2/6 schluckt eine Funktion</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;&amp;)
</code></pre>
<p>jede Art von Argument (l- oder rvalue), wobei T im Falle eines lvalue-Arguments als Referenz deduziert wird - das ist ja auch die Grundlage für perfektes Forwarding.</p>
<p>Umgekehrt schluckt</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;)
</code></pre>
<p>wirklich nur lvalues - und ist somit spezieller (sollte jedenfalls, der neue Abschnitt 14.8.2.4 Absatz 5 ist möglicherweise ein Problem). Da die partielle Ordnung von Templatespezialisierungen auf die von Überladenen Funktionstemplates verweist, muss das für obiges Problem entsprechend gelten.</p>
<p>krümelkacker schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int i = 23;
int &amp;  r1 = i;   // OK
int &amp;&amp; r2 = i;   // ill-formed

int &amp;  r3 = i+1; // ill-formed
int &amp;&amp; r4 = i+1; // OK
</code></pre>
</blockquote>
<p>Alles richtig, aber hier irrelevant.</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;);
template &lt;typename T&gt; void bar(T&amp;&amp;);
int i;
foo(i); // ok, foo&lt;int&gt;
foo(1); // Fehler
bar(i); // ok, bar&lt;int&amp;&gt;
bar(1); // ok, bar&lt;int&gt;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1905952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905952</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 02 Jun 2010 14:40:29 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 15:14:12 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>Dank der Kombinationsregel in 8.3.2/6 schluckt eine Funktion</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;&amp;)
</code></pre>
<p>jede Art von Argument (l- oder rvalue), wobei T im Falle eines lvalue-Arguments als Referenz deduziert wird - das ist ja auch die Grundlage für perfektes Forwarding.</p>
</blockquote>
<p>Ja. Aber das hat meinem Verständnis nach nichts mit der Deduktion beim Auffinden der richtigen Spezialisierung zu tun. Ich hatte mal eine ähnliche Frage, und zwar: &quot;Kann bei folgender concept_map T eine Lvalue-Referenz sein?&quot;</p>
<pre><code class="language-cpp">concept RvalueReference&lt;typename T&gt; {}

template&lt;typename T&gt;
concept_map RvalueReference&lt;T&amp;&amp;&gt; {}
</code></pre>
<p>und Doug Gregor verneinte das. Ich denke, dass es wegen der Ähnlichkeit zur partiellen Spezialisierung von Klassentemplates sich hier auch so verhält. Dann wäre die eine Spezialisierung nur für Lvalue-Referenzen, die andere nur für Rvalue-Referenzen da. Das hieße auch, dass das eine nicht spezieller ist als das andere ist. Selbst wenn die Spezialisierung mit T&amp; weggelassen wird, sollte die Spezialisierung mit &lt;T&amp;&amp;&gt; immer noch <em>nur</em> für Rvalue-Referenzen herhalten.</p>
<p>Perfect forwarding funktioniert wegen zwei Sonderregeln: (a) reference collapsing (b) Die Deduktionsregel. Die Deduktionsregel müsste nur für Funktionsaufrufe bei Funktionstemplates gelten und hier in diesem Fall keine Rolle spielen.</p>
<p>kk</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905970</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 02 Jun 2010 15:14:12 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 15:22:03 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>krümelkacker schrieb:</p>
<blockquote>
<p>…</p>
</blockquote>
<p>Alles richtig, aber hier irrelevant.</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;);
template &lt;typename T&gt; void bar(T&amp;&amp;);
int i;
foo(i); // ok, foo&lt;int&gt;
foo(1); // Fehler
bar(i); // ok, bar&lt;int&amp;&gt;
bar(1); // ok, bar&lt;int&gt;
</code></pre>
</blockquote>
<p>Alles richtig, aber hier irrelevant.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>... oder ich vertue mich grad hier ganz doll</p>
<p>kk</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905972</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905972</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 02 Jun 2010 15:22:03 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 15:24:08 GMT]]></title><description><![CDATA[<p>krümelkacker schrieb:</p>
<blockquote>
<p>Die Deduktionsregel müsste nur für Funktionsaufrufe bei Funktionstemplates gelten und hier in diesem Fall keine Rolle spielen.</p>
</blockquote>
<p>14.8.2.1/3 - Da hast du offenbar recht.</p>
<p>Dann liegt VC allerdings erst recht falsch, denn S&lt;T&amp;&amp;&gt; kann kein Kandidat für ein Argument des Typs int(&amp;)() sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905974</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 02 Jun 2010 15:24:08 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 15:25:59 GMT]]></title><description><![CDATA[<p>krümelkacker schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int &amp;&amp; r4 = i+1; // OK
</code></pre>
</blockquote>
<p>Hätte zu dieser Zeile grad 2 Fragen:</p>
<p>1. Was passiert hier genau ?</p>
<p>2. Auf was referenziert r4 nun?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905976</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 02 Jun 2010 15:25:59 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 15:39:10 GMT]]></title><description><![CDATA[<p>Dweb schrieb:</p>
<blockquote>
<p>krümelkacker schrieb:</p>
<blockquote>
<pre><code class="language-cpp">int &amp;&amp; r4 = i+1; // OK
</code></pre>
</blockquote>
<p>Hätte zu dieser Zeile grad 2 Fragen:<br />
1. Was passiert hier genau ?<br />
2. Auf was referenziert r4 nun?</p>
</blockquote>
<p>i+1 ist ein rvalue. Damit bezieht es sich erstmal auf den Wert/das Ergebnis und kein &quot;Objekt&quot; im Sinne des C++ Standards. Aber Rvalue-Referenzen sind ja dazu dar, dass man auf temporäre Objekte verweisen kann. Es wird also ein int-Objekt erzeugt und r4 so initialisiert, dass es auf dieses int-Objekt verweist. Wegen einer <a href="http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/" rel="nofollow">Sonderregel</a> wird die Lebenszeit des int-Objektes verlängert, so dass die Referenz auch danach noch gültig ist.</p>
<p>Dieser spezieller Code ist natürlich sinnfrei. In Verbindung mit auto aber auch nicht ganz unpraktisch:</p>
<pre><code class="language-cpp">{
  auto&amp;&amp; range = …;
  for (auto itr_ = begin(range), end_ = end(range);
       itr_ != end_;
       ++itr_)
  {
    int dings = *itr_;
  }
}
</code></pre>
<p>Jenachdem, was für &quot;…&quot; eingesetzt wird, kann range eine Rvalue-Referenz oder eine Lvalue-Referenz sein. So wird dann auch folgendes möglich:</p>
<pre><code class="language-cpp">vector&lt;int&gt; quelle();
…
{
  …
  for (int dings : quelle()) {
    cout &lt;&lt; ' ' &lt;&lt; dings;
  }
  …
}
</code></pre>
<p>ohne dass der vektor unnötig kopiert wird oder quelle() mehr als einmal aufgerufen wird...</p>
<p>camper schrieb:</p>
<blockquote>
<p>Umgekehrt schluckt</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;)
</code></pre>
<p>wirklich nur lvalues</p>
</blockquote>
<p>oder auch const rvalues.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905984</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 02 Jun 2010 15:39:10 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Wed, 02 Jun 2010 16:25:21 GMT]]></title><description><![CDATA[<p>krümelkacker schrieb:</p>
<blockquote>
<p>i+1 ist ein rvalue. Damit bezieht es sich erstmal auf den Wert/das Ergebnis und kein &quot;Objekt&quot; im Sinne des C++ Standards. Aber Rvalue-Referenzen sind ja dazu dar, dass man auf temporäre Objekte verweisen kann. Es wird also ein int-Objekt erzeugt und r4 so initialisiert, dass es auf dieses int-Objekt verweist. Wegen einer <a href="http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/" rel="nofollow">Sonderregel</a> wird die Lebenszeit des int-Objektes verlängert, so dass die Referenz auch danach noch gültig ist.</p>
</blockquote>
<p>danke dir <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1906010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1906010</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Wed, 02 Jun 2010 16:25:21 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Thu, 03 Jun 2010 12:15:31 GMT]]></title><description><![CDATA[<p>Joachim, regestrier dich mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1906300</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1906300</guid><dc:creator><![CDATA[Stacker]]></dc:creator><pubDate>Thu, 03 Jun 2010 12:15:31 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Thu, 03 Jun 2010 12:24:31 GMT]]></title><description><![CDATA[<p>krümelkacker schrieb:</p>
<blockquote>
<p>camper schrieb:</p>
<blockquote>
<p>Umgekehrt schluckt</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(T&amp;)
</code></pre>
<p>wirklich nur lvalues</p>
</blockquote>
<p>oder auch const rvalues.</p>
</blockquote>
<p>Das wäre mir neu.</p>
<p>Ich kenne nur, dass</p>
<pre><code class="language-cpp">template &lt;typename T&gt; void foo(const T&amp;)
</code></pre>
<p>auch rvalues nimmt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1906306</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1906306</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 03 Jun 2010 12:24:31 GMT</pubDate></item><item><title><![CDATA[Reply to RValue-Reference in VC 2010 on Thu, 03 Jun 2010 13:07:14 GMT]]></title><description><![CDATA[<p>Man kann den Templateparameter T vorgeben oder sich darauf verlassen, dass er zu &quot;const U&quot; für einen Klassentyp U deduziert wird, siehe:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

template&lt;class T&gt;
void ausgabe(T &amp; ref)  // &lt;-- hier steht kein const
{
  std::cout &lt;&lt; ref &lt;&lt; '\n';
}

const std::string rvalue()
{
  return &quot;dings&quot;;
}

int main()
{
  ausgabe(rvalue());
}
</code></pre>
<p>kk</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1906332</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1906332</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Thu, 03 Jun 2010 13:07:14 GMT</pubDate></item></channel></rss>