<?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[vector als Klassenanttribut]]></title><description><![CDATA[<p>Hi</p>
<p>Ist es möglich einen vector als Klassenattribut zu benutzen.</p>
<p>BSP:</p>
<p>[cpp]</p>
<p>....</p>
<p>class Test {</p>
<p>public:</p>
<p>int anzahl; // anzahl der Wörter<br />
vector &lt;char *&gt; wort(anzahl); // Hier soll dann &quot;wort&quot; in &quot;anzahl&quot; dimensionen erstellt werde, nur ich habe kp wie das gehen soll</p>
<p>an</p>
<p>};</p>
<p>....</p>
<p>[/c pp]</p>
<p>thx schonmal im vorraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/117556/vector-als-klassenanttribut</link><generator>RSS for Node</generator><lastBuildDate>Fri, 21 Aug 2026 00:51:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/117556.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Aug 2005 20:18:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to vector als Klassenanttribut on Mon, 08 Aug 2005 20:18:01 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>Ist es möglich einen vector als Klassenattribut zu benutzen.</p>
<p>BSP:</p>
<p>[cpp]</p>
<p>....</p>
<p>class Test {</p>
<p>public:</p>
<p>int anzahl; // anzahl der Wörter<br />
vector &lt;char *&gt; wort(anzahl); // Hier soll dann &quot;wort&quot; in &quot;anzahl&quot; dimensionen erstellt werde, nur ich habe kp wie das gehen soll</p>
<p>an</p>
<p>};</p>
<p>....</p>
<p>[/c pp]</p>
<p>thx schonmal im vorraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848299</guid><dc:creator><![CDATA[Ledd]]></dc:creator><pubDate>Mon, 08 Aug 2005 20:18:01 GMT</pubDate></item><item><title><![CDATA[Reply to vector als Klassenanttribut on Mon, 08 Aug 2005 20:24:40 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;int n =0&gt;
class nwords
{
char *c[n];
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/848304</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848304</guid><dc:creator><![CDATA[phlox81]]></dc:creator><pubDate>Mon, 08 Aug 2005 20:24:40 GMT</pubDate></item><item><title><![CDATA[Reply to vector als Klassenanttribut on Tue, 09 Aug 2005 05:53:29 GMT]]></title><description><![CDATA[<p>Man kann Vectoren als Klassenattribut benutzen. Anstelle von char * würde ich allerdings eher zu einem STL-String tendieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848412</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848412</guid><dc:creator><![CDATA[Mathias]]></dc:creator><pubDate>Tue, 09 Aug 2005 05:53:29 GMT</pubDate></item><item><title><![CDATA[Reply to vector als Klassenanttribut on Tue, 09 Aug 2005 05:59:24 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>überhaupt muss in der Deklaration die exakte Größe des Vektors<br />
nicht festgelegt werden.</p>
<pre><code class="language-cpp">#include &lt;vector&gt;

class Blubb
{
private:
    std::vector&lt; char* &gt;    meinVektor;    //Hinzufügen von Elementen mit meinVektor.push_back(...) ; Größe ist variabel

public:
    //...
};
</code></pre>
<p>oder gleich std::string verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848417</guid><dc:creator><![CDATA[BigBoomer]]></dc:creator><pubDate>Tue, 09 Aug 2005 05:59:24 GMT</pubDate></item><item><title><![CDATA[Reply to vector als Klassenanttribut on Tue, 09 Aug 2005 07:04:04 GMT]]></title><description><![CDATA[<p>Horror-Code! <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>
<pre><code class="language-cpp">#include &lt;vector&gt;
#include &lt;string&gt;

class B {
  std::vector&lt;std::string*&gt; meinVec;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/848434</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848434</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Tue, 09 Aug 2005 07:04:04 GMT</pubDate></item><item><title><![CDATA[Reply to vector als Klassenanttribut on Tue, 09 Aug 2005 12:00:43 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>und warum nimmst du zeiger auf strings ?</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6123">@bigboomer</a> wenn man allerdings die größe weiss und sie sich nicht mehr ändert hat man performance-vorteile, wenn man sie gleich bei der construktion angibt. Wenn dem aber so ist würde ich ohnehin zu boost::array tendieren. Da kann man die größe dann schön als template parameter übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848652</guid><dc:creator><![CDATA[prolog]]></dc:creator><pubDate>Tue, 09 Aug 2005 12:00:43 GMT</pubDate></item><item><title><![CDATA[Reply to vector als Klassenanttribut on Tue, 09 Aug 2005 12:38:50 GMT]]></title><description><![CDATA[<p>Artchi schrieb:</p>
<blockquote>
<p>Horror-Code!</p>
</blockquote>
<p>Ich habe doch nur char* verwendet, weil Ledd es auch getan hat. Es handelt sich<br />
nur um ein Beispiel.</p>
<p>Und: Ein bißchen mehr Info, warum es &quot;Horror-Code&quot; sein soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/848684</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/848684</guid><dc:creator><![CDATA[BigBoomer]]></dc:creator><pubDate>Tue, 09 Aug 2005 12:38:50 GMT</pubDate></item></channel></rss>