<?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[std::vector: Neues Objekt statt nur Referenz bekommen über at()]]></title><description><![CDATA[<p>Hallo,</p>
<p>gibt es eine Möglichkeit, ein Element aus einem std::vector statt als Referenz auch als neu konstruiertes Objekt zu bekommen?</p>
<p>Ist die einzige Möglichkeit, return T(<a href="http://myVector.at" rel="nofollow">myVector.at</a>(index)) zu schreiben?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/306854/std-vector-neues-objekt-statt-nur-referenz-bekommen-über-at</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2026 04:39:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/306854.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 09 Aug 2012 09:07:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::vector: Neues Objekt statt nur Referenz bekommen über at() on Thu, 09 Aug 2012 09:07:10 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>gibt es eine Möglichkeit, ein Element aus einem std::vector statt als Referenz auch als neu konstruiertes Objekt zu bekommen?</p>
<p>Ist die einzige Möglichkeit, return T(<a href="http://myVector.at" rel="nofollow">myVector.at</a>(index)) zu schreiben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2240312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2240312</guid><dc:creator><![CDATA[gfhgfhgf]]></dc:creator><pubDate>Thu, 09 Aug 2012 09:07:10 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector: Neues Objekt statt nur Referenz bekommen über at() on Thu, 09 Aug 2012 09:19:53 GMT]]></title><description><![CDATA[<p>gfhgfhgf schrieb:</p>
<blockquote>
<p>Ist die einzige Möglichkeit, return T(<a href="http://myVector.at" rel="nofollow">myVector.at</a>(index)) zu schreiben?</p>
</blockquote>
<p>Gibts damit ein Problem? Du willst ein neues Objekt, du erstellst ein neues Objekt. Ist doch ganz einfach und klar, wieso sollte es dafür eine spezielle Methode in std::vector geben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2240315</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2240315</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Thu, 09 Aug 2012 09:19:53 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector: Neues Objekt statt nur Referenz bekommen über at() on Thu, 09 Aug 2012 09:24:07 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>gfhgfhgf schrieb:</p>
<blockquote>
<p>Ist die einzige Möglichkeit, return T(<a href="http://myVector.at" rel="nofollow">myVector.at</a>(index)) zu schreiben?</p>
</blockquote>
<p>Gibts damit ein Problem? Du willst ein neues Objekt, du erstellst ein neues Objekt. Ist doch ganz einfach und klar, wieso sollte es dafür eine spezielle Methode in std::vector geben?</p>
</blockquote>
<p>ok passt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2240316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2240316</guid><dc:creator><![CDATA[fsdfsdfs]]></dc:creator><pubDate>Thu, 09 Aug 2012 09:24:07 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector: Neues Objekt statt nur Referenz bekommen über at() on Thu, 09 Aug 2012 12:52:55 GMT]]></title><description><![CDATA[<p>gfhgfhgf schrieb:</p>
<blockquote>
<p>Ist die einzige Möglichkeit, return T(<a href="http://myVector.at" rel="nofollow">myVector.at</a>(index)) zu schreiben?</p>
</blockquote>
<p>Ich weiß ja nicht, was der Rückgabetyp deiner Funktion ist. Wenn er ein Wert ist, wird sowieso kopiert. Wenn er eine Referenz ist, gibst du eine Referenz auf einen temporären Wert zurück. Warum lässt du es also nicht einfach normal?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2240393</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2240393</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Thu, 09 Aug 2012 12:52:55 GMT</pubDate></item></channel></rss>