<?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::push_back + structure]]></title><description><![CDATA[<p>Tagchen</p>
<p>ich habe in meiner klasse einen std::vector&lt;kundendaten&gt; xy<br />
wenn ich ein neuen kunden hinzufügen will mach ich das so:</p>
<pre><code class="language-cpp">xy.at(i).Vorname = &quot;...&quot; ;
xy.at(i).Nachname = &quot;...&quot; ;
xy.at(i).Ort = &quot;...&quot; ;
</code></pre>
<p>Funktioniert soweit.</p>
<p>Jetzt brauche ich aber std::vector::push_back um die neuen Daten ans Ende zu verfrachten.</p>
<p>xy.push_back( ??? ).Vorname?? Hilfe!</p>
<p>Bedanke mich im voraus :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/256441/std-vector-push_back-structure</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 08:20:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/256441.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 Dec 2009 21:23:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 21:23:44 GMT]]></title><description><![CDATA[<p>Tagchen</p>
<p>ich habe in meiner klasse einen std::vector&lt;kundendaten&gt; xy<br />
wenn ich ein neuen kunden hinzufügen will mach ich das so:</p>
<pre><code class="language-cpp">xy.at(i).Vorname = &quot;...&quot; ;
xy.at(i).Nachname = &quot;...&quot; ;
xy.at(i).Ort = &quot;...&quot; ;
</code></pre>
<p>Funktioniert soweit.</p>
<p>Jetzt brauche ich aber std::vector::push_back um die neuen Daten ans Ende zu verfrachten.</p>
<p>xy.push_back( ??? ).Vorname?? Hilfe!</p>
<p>Bedanke mich im voraus :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1821744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821744</guid><dc:creator><![CDATA[Jonny_Bravo]]></dc:creator><pubDate>Sat, 12 Dec 2009 21:23:44 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 21:25:39 GMT]]></title><description><![CDATA[<p>???</p>
<pre><code class="language-cpp">kundendaten kd;
kd.Vorname = &quot;...&quot;;
kd.Nachname = &quot;...&quot;;
kd.Ort = &quot;...&quot;;

xy.push_back(kd);
</code></pre>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1821746</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821746</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Sat, 12 Dec 2009 21:25:39 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 21:59:47 GMT]]></title><description><![CDATA[<p>Oder du schreibst dir einen Ctor und machst:</p>
<pre><code class="language-cpp">xy.push_back(kundendaten(&quot;Hans&quot;, &quot;Meier&quot;, &quot;Springfield&quot;));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1821766</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821766</guid><dc:creator><![CDATA[Blue-Tiger]]></dc:creator><pubDate>Sat, 12 Dec 2009 21:59:47 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 22:02:55 GMT]]></title><description><![CDATA[<p>arrr</p>
<p>das habe ich auch schon probiert, geht aber auch nicht:</p>
<pre><code class="language-cpp">//class.cpp
void Treasure::Add ( const std::string&amp; vorname, const std::string&amp; nachname, const std::string&amp; ort )
{
    KundenDaten.Vorname = vorname ;
    KundenDaten.Nachname = nachname ;
    KundenDaten.Ort = ort ;
    Data.push_back( KundenDaten ) ;
}
</code></pre>
<p>Die Struktur hab ich in der .h Datei so definiert:</p>
<pre><code class="language-cpp">//class.h

class xy
{
//...
private:
    struct KundenDaten
    {
	std::string Vorname ;
	std::string Nachname ;
	std::string Ort ;
    };
	std::vector&lt;KundenDaten&gt; Data ;
};
</code></pre>
<p>bekomme aber diese Fehlermeldung:</p>
<blockquote>
<p>3x error: expected unqualified-id before ‘.’ token</p>
</blockquote>
<p>Danke für deine Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1821767</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821767</guid><dc:creator><![CDATA[Jonny_Bravo]]></dc:creator><pubDate>Sat, 12 Dec 2009 22:02:55 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 22:09:34 GMT]]></title><description><![CDATA[<p>Du musst auch erst eine Variable dieses Typs anlegen:</p>
<pre><code class="language-cpp">KundenDaten kundenDatenVariable; // Hat bei dir gefehlt!

kundenDatenVariable.Vorname = vorname ;
kundenDatenVariable.Nachname = nachname ;
kundenDatenVariable.Ort = ort ;

Data.push_back( kundenDatenVariable ) ;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1821771</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821771</guid><dc:creator><![CDATA[asdyxcyxcyxc]]></dc:creator><pubDate>Sat, 12 Dec 2009 22:09:34 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 22:10:50 GMT]]></title><description><![CDATA[<p>peeeeeeeeeeeinlich</p>
<p>dankeee!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1821774</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821774</guid><dc:creator><![CDATA[Jonny_Bravo]]></dc:creator><pubDate>Sat, 12 Dec 2009 22:10:50 GMT</pubDate></item><item><title><![CDATA[Reply to std::vector::push_back + structure on Sat, 12 Dec 2009 22:10:55 GMT]]></title><description><![CDATA[<p>Ahhh, und was ich jetzt erst sehe... Du solltest die Struktur nicht in der Klasse deklarieren!</p>
<pre><code class="language-cpp">struct ...
{
}

class ...
{
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1821775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1821775</guid><dc:creator><![CDATA[asdyxcyxcyxc]]></dc:creator><pubDate>Sat, 12 Dec 2009 22:10:55 GMT</pubDate></item></channel></rss>