<?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[tr1::&amp;lt;array&amp;gt; Konstruktor]]></title><description><![CDATA[<p>Hallo,</p>
<p>wahrscheinlich ist es ganz einfach:<br />
Wieso kann ich die Template-Klasse array&lt;typename, size_t&gt; mit einer Initialisierungsliste ... initialisieren.</p>
<p>Deklariert ist es folgendermaßen: (<a href="http://msdn.microsoft.com/en-us/library/bb982761.aspx" rel="nofollow">MSDN</a>)</p>
<pre><code class="language-cpp">array();
    array(const array&amp; right);
</code></pre>
<p>Und kann dann so verwendet werden:</p>
<pre><code class="language-cpp">typedef std::tr1::array&lt;int, 4&gt; Myarray; 
int main() 
{ 
    Myarray c0 = {0, 1, 2, 3}; 

// display contents &quot; 0 1 2 3&quot; 
    for (Myarray::const_iterator it = c0.begin(); 
        it != c0.end(); ++it) 
        std::cout &lt;&lt; &quot; &quot; &lt;&lt; *it; 
    std::cout &lt;&lt; std::endl; 

    Myarray c1(c0); 

// display contents &quot; 0 1 2 3&quot; 
    for (Myarray::const_iterator it = c1.begin(); 
        it != c1.end(); ++it) 
        std::cout &lt;&lt; &quot; &quot; &lt;&lt; *it; 
    std::cout &lt;&lt; std::endl; 

    return (0); 
}
</code></pre>
<p>Die Konstruktoren sind ja einmal ohne Parameter (Default-Konstruktor) und der andere ist ein Copy-Konstruktor ... verstehe ich gerade nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/253700/tr1-lt-array-gt-konstruktor</link><generator>RSS for Node</generator><lastBuildDate>Sun, 13 Sep 2026 13:28:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/253700.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Nov 2009 14:34:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to tr1::&amp;lt;array&amp;gt; Konstruktor on Thu, 05 Nov 2009 14:41:08 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wahrscheinlich ist es ganz einfach:<br />
Wieso kann ich die Template-Klasse array&lt;typename, size_t&gt; mit einer Initialisierungsliste ... initialisieren.</p>
<p>Deklariert ist es folgendermaßen: (<a href="http://msdn.microsoft.com/en-us/library/bb982761.aspx" rel="nofollow">MSDN</a>)</p>
<pre><code class="language-cpp">array();
    array(const array&amp; right);
</code></pre>
<p>Und kann dann so verwendet werden:</p>
<pre><code class="language-cpp">typedef std::tr1::array&lt;int, 4&gt; Myarray; 
int main() 
{ 
    Myarray c0 = {0, 1, 2, 3}; 

// display contents &quot; 0 1 2 3&quot; 
    for (Myarray::const_iterator it = c0.begin(); 
        it != c0.end(); ++it) 
        std::cout &lt;&lt; &quot; &quot; &lt;&lt; *it; 
    std::cout &lt;&lt; std::endl; 

    Myarray c1(c0); 

// display contents &quot; 0 1 2 3&quot; 
    for (Myarray::const_iterator it = c1.begin(); 
        it != c1.end(); ++it) 
        std::cout &lt;&lt; &quot; &quot; &lt;&lt; *it; 
    std::cout &lt;&lt; std::endl; 

    return (0); 
}
</code></pre>
<p>Die Konstruktoren sind ja einmal ohne Parameter (Default-Konstruktor) und der andere ist ein Copy-Konstruktor ... verstehe ich gerade nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1803849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1803849</guid><dc:creator><![CDATA[FrEEzE2046]]></dc:creator><pubDate>Thu, 05 Nov 2009 14:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to tr1::&amp;lt;array&amp;gt; Konstruktor on Thu, 05 Nov 2009 17:33:52 GMT]]></title><description><![CDATA[<p>FrEEzE2046 schrieb:</p>
<blockquote>
<p>Deklariert ist es folgendermaßen: (<a href="http://msdn.microsoft.com/en-us/library/bb982761.aspx" rel="nofollow">MSDN</a>)</p>
<pre><code class="language-cpp">array();
    array(const array&amp; right);
</code></pre>
</blockquote>
<p>Richtig, allerdings werden diese Konstruktoren nicht explizit, sondern nur impliziert durch den Compiler deklariert - array bleibt damit ein Aggregat. Nebenbei bemerkt steht die Signatur des copy-ctors nur deshalb fest, weil als Templateparameter nur nnormale Container-compatible Typen zulässig sind, was einen entsprechenden Copy-ctor voraussetzt (nicht so in C++0x - nicht das exakte Signatur eine besondere Rolle spielen würde...).<br />
Der copy-ctor eines array&lt;auto_ptr&lt;int&gt; &gt; etwa hätte die Form array(array&amp;), weil das auch für auto_ptr so ist, nur ist ein auto_ptr eben kein zulässiges Argument.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1803969</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1803969</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 05 Nov 2009 17:33:52 GMT</pubDate></item><item><title><![CDATA[Reply to tr1::&amp;lt;array&amp;gt; Konstruktor on Fri, 06 Nov 2009 12:39:59 GMT]]></title><description><![CDATA[<p>Ich hab das mittlerweile schon rausbekommen, was du sagst, aber trotzdem danke für deine Antwort.<br />
Es konnte auch anders eigentlich nicht sein, was mich nur total gewundert hat (bzw. mmer noch tut), ist dass wenn man sich eine Instanz von array&lt;&gt; im Debugger anschaut, listet er direkt die Elemente (Indezes) des arrays auf.</p>
<p>Das verstehe ich nicht. Normalerweiße müsste noch hinter der Instanz des Objekts erst einmal das (array-)Member kommen. Wenn ich auf die Deklaration schaue, kann ich nichts besonderes erkennen:</p>
<pre><code class="language-cpp">template&lt;typename _Ty, size_t _Size&gt;
class array
{
public:
     _Ty _Elems[_Size == 0 ? 1 : _Size];
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1804369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1804369</guid><dc:creator><![CDATA[FrEEzE2046]]></dc:creator><pubDate>Fri, 06 Nov 2009 12:39:59 GMT</pubDate></item><item><title><![CDATA[Reply to tr1::&amp;lt;array&amp;gt; Konstruktor on Fri, 06 Nov 2009 13:28:33 GMT]]></title><description><![CDATA[<p>FrEEzE2046 schrieb:</p>
<blockquote>
<p>Ich hab das mittlerweile schon rausbekommen, was du sagst, aber trotzdem danke für deine Antwort.<br />
Es konnte auch anders eigentlich nicht sein, was mich nur total gewundert hat (bzw. mmer noch tut), ist dass wenn man sich eine Instanz von array&lt;&gt; im Debugger anschaut, listet er direkt die Elemente (Indezes) des arrays auf.</p>
<p>Das verstehe ich nicht. Normalerweiße müsste noch hinter der Instanz des Objekts erst einmal das (array-)Member kommen. Wenn ich auf die Deklaration schaue, kann ich nichts besonderes erkennen:</p>
<pre><code class="language-cpp">template&lt;typename _Ty, size_t _Size&gt;
class array
{
public:
     _Ty _Elems[_Size == 0 ? 1 : _Size];
}
</code></pre>
</blockquote>
<p>VS hat für den Debugger 'Visualizer' die es ermöglichen objekte zu beschreiben und anders darzustellen. In diesem Fall liegt wohl ein Visualizer vor der es als array darstellt. siehe %VSDIR%\Common7\Packages\Debugger\autoexp.dat</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1804391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1804391</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Fri, 06 Nov 2009 13:28:33 GMT</pubDate></item><item><title><![CDATA[Reply to tr1::&amp;lt;array&amp;gt; Konstruktor on Fri, 06 Nov 2009 13:33:10 GMT]]></title><description><![CDATA[<p>evilissimo schrieb:</p>
<blockquote>
<p>VS hat für den Debugger 'Visualizer' die es ermöglichen objekte zu beschreiben und anders darzustellen. In diesem Fall liegt wohl ein Visualizer vor der es als array darstellt. siehe %VSDIR%\Common7\Packages\Debugger\autoexp.dat</p>
</blockquote>
<p>Achso ... es ist ja nicht so, dass ich es hätte verwenden wollen, aber interessiert hatte es mich dennoch mal, danke.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1804394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1804394</guid><dc:creator><![CDATA[FrEEzE2046]]></dc:creator><pubDate>Fri, 06 Nov 2009 13:33:10 GMT</pubDate></item></channel></rss>