<?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[Was haltet ihr von meiner eigenen CONTAINER Klasse?]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab' mal eine eigene Container Klasse geschrieben. Sie müsste mehr oder weniger Fehlerfrei sein.<br />
Ihr könnt sie ja gern auch noch mal testen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Was ich sehr schön finde ist dass man auch die std::sort(...) Funktion nutzen kann:</p>
<p>Ein test Programm müsst ihr euch aber selber schreiben, hier ist nur die Klasse:</p>
<pre><code class="language-cpp">//
// ============ math -&gt; Container class ============
//
// Copyright (c) 2008 Lukas Hermanns
//

#ifndef __MATH_CONTAINER__
#define __MATH_CONTAINER__

namespace math
{

template &lt;typename T&gt; class container
{

    public:

        /* Type definitions */

        typedef T*          iterator;
        typedef T* const    const_iterator;

        /* Constructors */

        container() : array_(0), len_(0)
        {
        }

        container(unsigned int size) : array_(0), len_(0)
        {
            create(size);
        }

        /* Destructor */

        ~container()
        {
            clear();
        }

        /* Operators - comparision */

        bool operator == (container&lt;T&gt; other)
        {
            /* Check if the containers are not emtpy */
            if (!array_ || !other.array_)
                return false;

            /* Loop the elements */
            for (unsigned int i = 0; i &lt; len_; ++i)
            {
                if (array_[i] != other.array_[i])
                    return false;
            }

            /* Exit the function */
            return true;
        }

        bool operator != (container&lt;T&gt; other)
        {
            /* Check if the containers are not emtpy */
            if (!array_ || !other.array_)
                return false;

            /* Loop the elements */
            for (unsigned int i = 0; i &lt; len_; ++i)
            {
                if (array_[i] != other.array_[i])
                    return true;
            }

            /* Exit the function */
            return false;
        }

        /* Operators - settings / gettings */

        T&amp; operator [] (unsigned int index)
        {
            return array_[index];
        }

        container&lt;T&gt;&amp; operator = (container&lt;T&gt; other)
        {
            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Allcoate new memory */
            array_ = new T[other.len_];
            len_ = other.len_;

            /* Copy the memory */
            memcpy(array_, other.array_, other.len_ * sizeof(T));

            /* Return the reference of this object */
            return *this;
        }

        /* Functions */

        bool empty()
        {
            return array_ == 0;
        }

        unsigned int size()
        {
            return len_;
        }

        const_iterator begin()
        {
            return array_ ? &amp;array_[0] : 0;
        }

        const_iterator end()
        {
            return array_ ? &amp;array_[len_] : 0;
        }

        const_iterator get_iterator(unsigned int index)
        {
            return array_ ? &amp;array_[index] : 0;
        }

        void create(unsigned int size)
        {
            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Allocate new memory */
            array_ = new T[size];

            /* Initialize the new memory */
            memset(array_, 0, len_ * sizeof(T));

            /* Set the length of the memory */
            len_ = size;
        }

        void clear()
        {
            if (array_)
            {
                delete array_;
                array_ = 0;
            }
            len_ = 0;
        }

        void add(T obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            memcpy(tmp, array_, len_ * sizeof(T));

            /* Add the new object */
            tmp[len_] = obj;

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            ++len_;
        }

        void insert(const_iterator it, T obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            memcpy(tmp, array_, len_ * sizeof(T));

            /* Loop the old memory */
            for (register unsigned int i = len_; i &gt; it - &amp;array_[0]; --i)
                tmp[i] = array_[i-1];

            /* Add the new object */
            tmp[it - &amp;array_[0&rsqb;&rsqb; = obj;

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            ++len_;
        }

        void erase(const_iterator it)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - 1) * sizeof(T));

            /* Loop the old memory */
            for (register unsigned int i = it - &amp;array_[0]; i &lt; len_ - 1; ++i)
                tmp[i] = array_[i+1];

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            --len_;
        }

        void erase(const_iterator begin, const_iterator end)
        {
            /* Allocate a temporary memory */
            const unsigned int less = end - begin + 1;
            T* tmp = new T[len_ - less];

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - less) * sizeof(T));

            /* Loop the old memory */
            for (register unsigned int i = begin - &amp;array_[0]; i &lt; len_ - less; ++i)
                tmp[i] = array_[i+less];

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            len_ -= less;
        }

        void erase_begin()
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Save the old mamory */
            T* oldarray = array_;

            /* Move the old memory */
            ++array_;

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - 1) * sizeof(T));

            /* Delete the old memory */
            if (oldarray)
                delete oldarray;

            /* Use the new memory */
            array_ = tmp;
            --len_;
        }

        void erase_end()
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - 1) * sizeof(T));

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            --len_;
        }

        void swap(container&lt;T&gt; &amp;other)
        {
            /* Check if the containers are not emtpy */
            if (!array_ || !other.array_)
                return;

            /* Allocate temporary memory */
            T* tmp = array_;
            unsigned int len = len_;

            /* Swap the memories */
            array_ = other.array_;
            other.array_ = tmp;

            /* Swap the lengths */
            len_ = other.len_;
            other.len_ = len;
        }

        void flip()
        {
            /* Check if the container is not empty */
            if (!array_)
                return;

            /* Allocate temporary memory */
            T* tmp = new T[len_];

            /* Fill the temporary memory */
            memcpy(tmp, array_, len_ * sizeof(T));

            /* Loop and flip the container */
            for (register unsigned int i = 0; i &lt; len_; ++i)
            {
                array_[i] = tmp[len_ - i - 1];
            }

            /* Delete the temorary memory */
            delete tmp;
        }

        void unique()
        {
            /* Loop the container - main */
            for (register unsigned int i = 0, j; i &lt; len_; ++i)
            {
                /* Loop the container - sub */
                for (j = 0; j &lt; len_;)
                {
                    if (i != j &amp;&amp; array_[i] == array_[j])
                        erase(begin() + j);
                    else
                        ++j;
                }
            }
        }

    private:

        /* Members */

        T* array_;

        unsigned int len_;

};

} // /namespace math

#endif

// =========================================================
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/218428/was-haltet-ihr-von-meiner-eigenen-container-klasse</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 23:44:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/218428.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 20 Jul 2008 20:12:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 20:12:46 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich hab' mal eine eigene Container Klasse geschrieben. Sie müsste mehr oder weniger Fehlerfrei sein.<br />
Ihr könnt sie ja gern auch noch mal testen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Was ich sehr schön finde ist dass man auch die std::sort(...) Funktion nutzen kann:</p>
<p>Ein test Programm müsst ihr euch aber selber schreiben, hier ist nur die Klasse:</p>
<pre><code class="language-cpp">//
// ============ math -&gt; Container class ============
//
// Copyright (c) 2008 Lukas Hermanns
//

#ifndef __MATH_CONTAINER__
#define __MATH_CONTAINER__

namespace math
{

template &lt;typename T&gt; class container
{

    public:

        /* Type definitions */

        typedef T*          iterator;
        typedef T* const    const_iterator;

        /* Constructors */

        container() : array_(0), len_(0)
        {
        }

        container(unsigned int size) : array_(0), len_(0)
        {
            create(size);
        }

        /* Destructor */

        ~container()
        {
            clear();
        }

        /* Operators - comparision */

        bool operator == (container&lt;T&gt; other)
        {
            /* Check if the containers are not emtpy */
            if (!array_ || !other.array_)
                return false;

            /* Loop the elements */
            for (unsigned int i = 0; i &lt; len_; ++i)
            {
                if (array_[i] != other.array_[i])
                    return false;
            }

            /* Exit the function */
            return true;
        }

        bool operator != (container&lt;T&gt; other)
        {
            /* Check if the containers are not emtpy */
            if (!array_ || !other.array_)
                return false;

            /* Loop the elements */
            for (unsigned int i = 0; i &lt; len_; ++i)
            {
                if (array_[i] != other.array_[i])
                    return true;
            }

            /* Exit the function */
            return false;
        }

        /* Operators - settings / gettings */

        T&amp; operator [] (unsigned int index)
        {
            return array_[index];
        }

        container&lt;T&gt;&amp; operator = (container&lt;T&gt; other)
        {
            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Allcoate new memory */
            array_ = new T[other.len_];
            len_ = other.len_;

            /* Copy the memory */
            memcpy(array_, other.array_, other.len_ * sizeof(T));

            /* Return the reference of this object */
            return *this;
        }

        /* Functions */

        bool empty()
        {
            return array_ == 0;
        }

        unsigned int size()
        {
            return len_;
        }

        const_iterator begin()
        {
            return array_ ? &amp;array_[0] : 0;
        }

        const_iterator end()
        {
            return array_ ? &amp;array_[len_] : 0;
        }

        const_iterator get_iterator(unsigned int index)
        {
            return array_ ? &amp;array_[index] : 0;
        }

        void create(unsigned int size)
        {
            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Allocate new memory */
            array_ = new T[size];

            /* Initialize the new memory */
            memset(array_, 0, len_ * sizeof(T));

            /* Set the length of the memory */
            len_ = size;
        }

        void clear()
        {
            if (array_)
            {
                delete array_;
                array_ = 0;
            }
            len_ = 0;
        }

        void add(T obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            memcpy(tmp, array_, len_ * sizeof(T));

            /* Add the new object */
            tmp[len_] = obj;

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            ++len_;
        }

        void insert(const_iterator it, T obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            memcpy(tmp, array_, len_ * sizeof(T));

            /* Loop the old memory */
            for (register unsigned int i = len_; i &gt; it - &amp;array_[0]; --i)
                tmp[i] = array_[i-1];

            /* Add the new object */
            tmp[it - &amp;array_[0&rsqb;&rsqb; = obj;

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            ++len_;
        }

        void erase(const_iterator it)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - 1) * sizeof(T));

            /* Loop the old memory */
            for (register unsigned int i = it - &amp;array_[0]; i &lt; len_ - 1; ++i)
                tmp[i] = array_[i+1];

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            --len_;
        }

        void erase(const_iterator begin, const_iterator end)
        {
            /* Allocate a temporary memory */
            const unsigned int less = end - begin + 1;
            T* tmp = new T[len_ - less];

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - less) * sizeof(T));

            /* Loop the old memory */
            for (register unsigned int i = begin - &amp;array_[0]; i &lt; len_ - less; ++i)
                tmp[i] = array_[i+less];

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            len_ -= less;
        }

        void erase_begin()
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Save the old mamory */
            T* oldarray = array_;

            /* Move the old memory */
            ++array_;

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - 1) * sizeof(T));

            /* Delete the old memory */
            if (oldarray)
                delete oldarray;

            /* Use the new memory */
            array_ = tmp;
            --len_;
        }

        void erase_end()
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Copy the memory */
            memcpy(tmp, array_, (len_ - 1) * sizeof(T));

            /* Delete the old memory */
            if (array_)
                delete array_;

            /* Use the new memory */
            array_ = tmp;
            --len_;
        }

        void swap(container&lt;T&gt; &amp;other)
        {
            /* Check if the containers are not emtpy */
            if (!array_ || !other.array_)
                return;

            /* Allocate temporary memory */
            T* tmp = array_;
            unsigned int len = len_;

            /* Swap the memories */
            array_ = other.array_;
            other.array_ = tmp;

            /* Swap the lengths */
            len_ = other.len_;
            other.len_ = len;
        }

        void flip()
        {
            /* Check if the container is not empty */
            if (!array_)
                return;

            /* Allocate temporary memory */
            T* tmp = new T[len_];

            /* Fill the temporary memory */
            memcpy(tmp, array_, len_ * sizeof(T));

            /* Loop and flip the container */
            for (register unsigned int i = 0; i &lt; len_; ++i)
            {
                array_[i] = tmp[len_ - i - 1];
            }

            /* Delete the temorary memory */
            delete tmp;
        }

        void unique()
        {
            /* Loop the container - main */
            for (register unsigned int i = 0, j; i &lt; len_; ++i)
            {
                /* Loop the container - sub */
                for (j = 0; j &lt; len_;)
                {
                    if (i != j &amp;&amp; array_[i] == array_[j])
                        erase(begin() + j);
                    else
                        ++j;
                }
            }
        }

    private:

        /* Members */

        T* array_;

        unsigned int len_;

};

} // /namespace math

#endif

// =========================================================
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1550506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550506</guid><dc:creator><![CDATA[LukasBanana]]></dc:creator><pubDate>Sun, 20 Jul 2008 20:12:46 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 20:14:43 GMT]]></title><description><![CDATA[<p>Naja, die Benennung von privaten Membervariablen gefällt mir nicht so...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550507</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550507</guid><dc:creator><![CDATA[Kritiseur]]></dc:creator><pubDate>Sun, 20 Jul 2008 20:14:43 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 20:18:11 GMT]]></title><description><![CDATA[<p>Oh, hab ich da einen Fehler entdeckt? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code class="language-cpp">assert( container&lt;int&gt;() == container&lt;int&gt;() );
</code></pre>
<p>edit: Ich hab's nicht durch nen Compiler laufen lassen, bin aber hier</p>
<pre><code class="language-cpp">if (!array_ || !other.array_)
                return false;
</code></pre>
<p>stutzig geworden wegen wenn beide leer und so.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550509</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550509</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 20 Jul 2008 20:18:11 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 20:42:13 GMT]]></title><description><![CDATA[<p>LukasBanana schrieb:</p>
<blockquote>
<p>Sie müsste mehr oder weniger Fehlerfrei sein.</p>
</blockquote>
<p>Ist sie bei weitem nicht, was durch minimale Tests feststellbar ist. Hausaufgaben machen wir hier nicht. Falls du eine spezifische Frage hast, stelle sie.<br />
Es erschließt sich mir bisher nicht, zu welchem Zweck dieser Thread eröffnet wurde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550518</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550518</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sun, 20 Jul 2008 20:42:13 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 20:45:51 GMT]]></title><description><![CDATA[<p>na ich sehe jetzt zwar nicht so den Sinn darin, aber das hier ist mir aufgefallen:</p>
<ol>
<li>delete [] array_.</li>
<li>add sollte const T&amp; als parameter nehmen, oder noch besser abhängig obs kleine oder große Typen sind (boost hat da was zu)</li>
<li>Dein Container funzt wohl nicht richtig mit komplexen Objekten, da du den Speicehr mit memcpy koopierst. Verwende lieber std::copy</li>
<li>swap tauscht den Inhalt nicht, wenn ein Container leer ist</li>
<li>op== sollte auf != zugreifen oder andersrum. außerdem sind zwei container doch gleich, wenn beide leer sind, oder?</li>
<li>du solltest einen const T&amp; op[] const mit anbieten.</li>
<li>flip und unique sollte lieber außerhalb implmenetiert werden, da diese algos auch auf anderen strukturen funktionieren. Deshalb gibts ja auch std::reverse und std::unique <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/1550520</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550520</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Sun, 20 Jul 2008 20:45:51 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 20:52:16 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef T* const    const_iterator;
</code></pre>
<p><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="😮"
    /><br />
Das geht zwar, aber die std:: Container machen das anders.</p>
<p>Gruß<br />
Don06</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550523</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550523</guid><dc:creator><![CDATA[Don06]]></dc:creator><pubDate>Sun, 20 Jul 2008 20:52:16 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Sun, 20 Jul 2008 21:03:24 GMT]]></title><description><![CDATA[<p>sollte es nicht eh</p>
<pre><code class="language-cpp">typedef const T* const_iterator;
</code></pre>
<p>heissen?immerhin soll ja T konstant sein, und nicht der iterator.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550526</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550526</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sun, 20 Jul 2008 21:03:24 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 08:04:18 GMT]]></title><description><![CDATA[<p>Kurz beim Überfliegen durchgezählt:<br />
12 offensichtliche Fehler<br />
12 Designfehler<br />
18 WTFs<br />
Was ich davon halte? gar nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550698</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Mon, 21 Jul 2008 08:04:18 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 08:58:25 GMT]]></title><description><![CDATA[<p>Um was für einen Container handelt es sich denn? Wäre nett wenn du das dazugeschrieben hättest und uns nicht raten liesest.</p>
<p>P.S. natürlich hab ich sofort gesehen, dass es eine schlechte Implementation von einem dynamischen Array sein soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550745</guid><dc:creator><![CDATA[container-liebhaber]]></dc:creator><pubDate>Mon, 21 Jul 2008 08:58:25 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 09:14:58 GMT]]></title><description><![CDATA[<p>*hust hust* XD</p>
<p>okay, also eigentlich habe ich nur mal eine eigene Container Klasse geschrieben um mich mehr mit pointern usw. auseinander zu setzten. Ich hatte natürlich nie vor die STL zu verbessern.</p>
<p>Ich hab den Thread hier halt aufgemacht weil ich das nicht extra zu Projekten stellen wollte, aber ich wollte lediglich wissen ob das soweit ganz gut, oder eben wie sich herausgestellt hat schlecht aus sieht.</p>
<p>Trotzdem danke für eure Kritik <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550758</guid><dc:creator><![CDATA[LukasBanana]]></dc:creator><pubDate>Mon, 21 Jul 2008 09:14:58 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 09:15:47 GMT]]></title><description><![CDATA[<p>Du solltest in Erwägung ziehen, dass Ganze in etwa so zu implementieren:</p>
<pre><code class="language-cpp">// 
// ============ math -&gt; Vector class ============ 
// 
// Copyright (c) 2008 Lukas Hermanns 
// 

#ifndef MATH_VECTOR
#define MATH_VECTOR 

#include &lt;vector&gt;

namespace math 
{
    using std::vector;
}
#endif // MATH_VECTOR
</code></pre>
<p>Da kannst du weniger Fehler machen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Gruß<br />
Don06</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550760</guid><dc:creator><![CDATA[Don06]]></dc:creator><pubDate>Mon, 21 Jul 2008 09:15:47 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 10:17:28 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#ifndef MATH_VECTOR
#define MATH_VECTOR

#include &lt;vector&gt;

template class&lt;T&gt; 
class math : public std::vector&lt;T&gt;{};

#endif // MATH_VECTOR
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1550804</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550804</guid><dc:creator><![CDATA[MontagMorgen]]></dc:creator><pubDate>Mon, 21 Jul 2008 10:17:28 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 10:43:56 GMT]]></title><description><![CDATA[<p>MontagMorgen schrieb:</p>
<blockquote>
<pre><code class="language-cpp">class math : public std::vector&lt;T&gt;{};
</code></pre>
</blockquote>
<p>Es gab hier schon mehrere Diskussionen darüber, dass man nicht von STL-Containern erben sollte (u.a. wegen nicht vorhandenem virtuellen Destruktor).</p>
<p>@ LukasBanana<br />
Ich würde mich noch einmal genau mit den Grundlagen auseinander setzen. Wenn du einen sauberen C++-Container erstellen willst, kannst du z.B. auch auf <code>memcpy</code> verzichten. Ausserdem ist ein Iterator <strong>nicht</strong> das Gleiche wie ein Zeiger; wenn du schon Typedefs machen willst, nenn sie wenigstens <code>pointer</code> und <code>const_pointer</code> . Allerdings finde ich das sowieso nicht sehr angebracht, zumal man einfach mit Hilfe des Adressoperators und der Rückgabefunktionen der jeweiligen Elemente auch einen Zeiger auf ein Element bekommt...</p>
<p>Und bevor du den Container mit irgendwelchen Funktionen ausbaust, solltest du zuerst einige <strong>wichtige</strong> Methoden richtig implementieren ( <code>push_back()</code> , <code>pop_back()</code> , <code>erase()</code> , <code>insert()</code> , <code>size()</code> , <code>clear()</code> ) plus Konstruktoren, op= und Destruktor. Teste den Container auch ausreichend.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550823</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550823</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Mon, 21 Jul 2008 10:43:56 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 10:56:01 GMT]]></title><description><![CDATA[<p>Hey ihr kaggn00bs für mathematische Vektoren gibts std::valarray, oh Mann was für n00bs ihr seid, ey!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550830</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550830</guid><dc:creator><![CDATA[Ihr Kaggn00bs]]></dc:creator><pubDate>Mon, 21 Jul 2008 10:56:01 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 11:43:46 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Ich würde mich noch einmal genau mit den Grundlagen auseinander setzen. Wenn du einen sauberen C++-Container erstellen willst, kannst du z.B. auch auf <code>memcpy</code> verzichten. Ausserdem ist ein Iterator <strong>nicht</strong> das Gleiche wie ein Zeiger; wenn du schon Typedefs machen willst, nenn sie wenigstens <code>pointer</code> und <code>const_pointer</code> . Allerdings finde ich das sowieso nicht sehr angebracht, zumal man einfach mit Hilfe des Adressoperators und der Rückgabefunktionen der jeweiligen Elemente auch einen Zeiger auf ein Element bekommt...</p>
</blockquote>
<p>dir ist schon klar dass es gängig ist auf der höchsten optimierungsstufe iteratoren in vectoren als reine zeiger zu implementieren, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550873</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Mon, 21 Jul 2008 11:43:46 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 11:49:03 GMT]]></title><description><![CDATA[<p>Oder anders ausgedrückt: Der Iterator ist ein Konzept, der das Konzept des Zeigers (auf Arrayelemente) auf beliebige Container abstrahiert. Bei allen Anforderungen, die an Iteratoren gestellt werden können, ist der nackte Zeiger sogar der einfachste mögliche Iterator, der jede einzelne davon erfüllt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550877</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 21 Jul 2008 11:49:03 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Mon, 21 Jul 2008 11:52:38 GMT]]></title><description><![CDATA[<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>dir ist schon klar dass es gängig ist auf der höchsten optimierungsstufe iteratoren in vectoren als reine zeiger zu implementieren, oder?</p>
</blockquote>
<p>Ich wollte nur das potenzielle Missverständnis vermeiden, dass Iteratoren generell immer nur Zeiger (mit deren Arithmetik) wären - auch wenn es bei <code>std::vector</code> so sein mag, ist es nicht bei allen Containern der Fall. Ich bin mir auch bewusst, dass es hier um ein vector-ähnliches Gebilde geht. Aber demnach ist der Bezeichner <code>iterator</code> hier durchaus gerechtfertigt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1550879</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1550879</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Mon, 21 Jul 2008 11:52:38 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 10:13:26 GMT]]></title><description><![CDATA[<p>Also ich hab das ganze noch mal ein <em>bischen</em> überarbeite <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Ich habe an einigen Stellen auf eure Tipps bzw. Kritik gehört und hoffe dass meien Klasse jetzt schon eher ansprechend aussieht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>Erneuerungen:</p>
<p>(* ein paar Namensänderungen)<br />
* delete [] data_<br />
* &quot;std::copy&quot; &amp; &quot;std::fill&quot; statt &quot;memcpy&quot; &amp; &quot;memset&quot;<br />
* zusätzlich: const T&amp; operator [] (u32 index) const { /* ... */ }<br />
* kein NULL mehr in Benutzung<br />
* &quot;push_back&quot; &amp; &quot;push_front&quot; statt &quot;add&quot;<br />
* eigene 'typedefs' wie &quot;u32&quot; statt &quot;unsigned int&quot;</p>
<p>Hier ist die neue Klasse:</p>
<pre><code>//
// ============ math -&gt; Container class ============
//
// Copyright (c) 2008 Lukas Hermanns
//

#ifndef __MATH_CONTAINER__
#define __MATH_CONTAINER__

#include &lt;algorithm&gt;
#include &lt;cstdlib&gt;
#include &lt;math.h&gt;

typedef char                c8;
typedef wchar_t             c16;

typedef signed char         s8;
typedef signed short        s16;
typedef signed int          s32;
typedef signed long int     s64;

typedef unsigned char       u8;
typedef unsigned short      u16;
typedef unsigned int        u32;
typedef unsigned long int   u64;

typedef float               f32;
typedef double              f64;

namespace dim
{

template &lt;typename T&gt; class array
{

    public:

        /* Type definitions */

        typedef T*          iterator;
        typedef T* const    const_iterator;

        /* Constructors */

        array() : data_(0), len_(0)
        {
        }

        array(u32 size) : data_(0), len_(0)
        {
            create(size);
        }

        /* Destructor */

        ~array()
        {
            clear();
        }

        /* Operators - comparision */

        bool operator == (array&lt;T&gt; other)
        {
            /* Check if the arrays are not emtpy */
            if (!data_ || !other.data_)
                return false;

            /* Loop the elements */
            for (u32 i = 0; i &lt; len_; ++i)
            {
                if (data_[i] != other.data_[i])
                    return false;
            }

            /* Exit the function */
            return true;
        }

        bool operator != (array&lt;T&gt; other)
        {
            /* Check if the arrays are not emtpy */
            if (!data_ || !other.data_)
                return false;

            /* Loop the elements */
            for (u32 i = 0; i &lt; len_; ++i)
            {
                if (data_[i] != other.data_[i])
                    return true;
            }

            /* Exit the function */
            return false;
        }

        /* Operators - settings / gettings */

        T&amp; operator [] (u32 index)
        {
            return data_[index];
        }

        const T&amp; operator [] (u32 index) const
        {
            return data_[index];
        }

        array&lt;T&gt;&amp; operator = (const array&lt;T&gt; &amp;other)
        {
            /* Delete the old memory */
            if (data_)
                delete [] data_;

            /* Allcoate new memory */
            data_ = new T[other.len_];
            len_ = other.len_;

            /* Copy the memory */
            std::copy(&amp;other.data_[0], &amp;other.data_[other.len_], &amp;data_[0]);

            /* Return the reference of this object */
            return *this;
        }

        /* Functions */

        bool empty()
        {
            return !data_;
        }

        u32 size()
        {
            return len_;
        }

        const_iterator begin()
        {
            return data_ ? &amp;data_[0] : 0;
        }

        const_iterator end()
        {
            return data_ ? &amp;data_[len_] : 0;
        }

        void create(u32 size)
        {
            /* Delete the old memory */
            if (data_)
                delete [] data_;

            /* Allocate new memory */
            data_ = new T[size];

            /* Set the length of the memory */
            len_ = size;

            /* Initialize the new memory */
            std::fill(begin(), end(), (T)0);
        }

        void clear()
        {
            if (data_)
            {
                delete [] data_;
                data_ = 0;
            }
            len_ = 0;
        }

        void push_back(const T &amp;obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            std::copy(begin(), end(), &amp;tmp[0]);

            /* Add the new object */
            tmp[len_] = obj;

            /* Delete the old memory */
            if (data_)
                delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            ++len_;
        }

        void push_front(const T &amp;obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            ++tmp;
            std::copy(begin(), end(), &amp;tmp[0]);
            --tmp;

            /* Add the new object */
            tmp[0] = obj;

            /* Delete the old memory */
            if (data_)
                delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            ++len_;
        }

        void push_back(const T array[], u32 size)
        {
            for (register u32 i = 0; i &lt; size; ++i)
                push_back(array[i]);
        }

        void push_front(const T array[], u32 size)
        {
            for (register u32 i = 0; i &lt; size; ++i)
                push_front(array[i]);
        }

        void insert(const_iterator it, const T &amp;obj)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ + 1];

            /* Copy the memory */
            std::copy(begin(), end(), &amp;tmp[0]);

            /* Loop the old memory */
            for (register u32 i = len_; i &gt; it - &amp;data_[0]; --i)
                tmp[i] = data_[i-1];

            /* Add the new object */
            tmp[it - &amp;data_[0&rsqb;&rsqb; = obj;

            /* Delete the old memory */
            if (data_)
                delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            ++len_;
        }

        void erase(const_iterator it)
        {
            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Copy the memory */
            std::copy(begin(), end() - 1, &amp;tmp[0]);

            /* Loop the old memory */
            for (register u32 i = it - &amp;data_[0]; i &lt; len_ - 1; ++i)
                tmp[i] = data_[i+1];

            /* Delete the old memory */
            if (data_)
                delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            --len_;
        }

        void erase(const_iterator begin, const_iterator end)
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Allocate a temporary memory */
            const u32 less = end - begin + 1;
            T* tmp = new T[len_ - less];

            /* Copy the memory */
            std::copy(begin(), end() - less, &amp;tmp[0]);

            /* Loop the old memory */
            for (register u32 i = begin - &amp;data_[0]; i &lt; len_ - less; ++i)
                tmp[i] = data_[i+less];

            /* Delete the old memory */
            delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            len_ -= less;
        }

        void erase_front()
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Save the old mamory */
            T* oldarray = data_;

            /* Move the old memory */
            ++data_;

            /* Copy the memory */
            std::copy(begin(), end() - 1, &amp;tmp[0]);

            /* Delete the old memory */
            delete [] oldarray;

            /* Use the new memory */
            data_ = tmp;
            --len_;
        }

        void erase_back()
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Allocate a temporary memory */
            T* tmp = new T[len_ - 1];

            /* Copy the memory */
            std::copy(begin(), end() - 1, &amp;tmp[0]);

            /* Delete the old memory */
            delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            --len_;
        }

        void move(const_iterator itbegin, const_iterator itend, const_iterator it)
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Allocate a temporary memory */
            T* tmp = new T[len_];

            /* Copy the memory */
            std::copy(begin(), end(), &amp;tmp[0]);

            /* Move the memory */
            register u32 i;
            for (i = 0; i &lt;= itend - itbegin; ++i)
                data_[i + (it - &amp;data_[0])] = tmp[i + (itbegin - &amp;data_[0])];

            /* Move the rest of the memory */
            if (it &lt;= itbegin)
            {
                for (i = 0; i &lt; itbegin - it; ++i)
                    data_[i + (it - &amp;data_[0]) + itend - itbegin + 1] = tmp[i + (it - &amp;data_[0])];
            }
            else
            {
                for (i = 0; i &lt; it - itbegin; ++i)
                    data_[i + (itbegin - &amp;data_[0])] = tmp[i + (itend - &amp;data_[0] + 1)];
            }

            /* Delete temporary meory */
            delete [] tmp;
        }

        void resize(u32 newsize)
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Allocate a temporary memory */
            T* tmp = new T[newsize];

            /* Initialize the new memory */
            std::fill(&amp;tmp[0], &amp;tmp[newsize], (T)0);

            /* Copy the memory */
            const_iterator itend = (newsize &gt; len_ ? end() : begin() + newsize);
            std::copy(begin(), itend, &amp;tmp[0]);

            /* Delete the old memory */
            delete [] data_;

            /* Use the new memory */
            data_ = tmp;
            len_ = newsize;
        }

        void swap(array&lt;T&gt; &amp;other)
        {
            /* Check if the data are not emtpy */
            if (!data_ &amp;&amp; !other.data_)
                return;

            /* Allocate temporary memory */
            T* tmp = data_;
            u32 len = len_;

            /* Swap the memories */
            data_ = other.data_;
            other.data_ = tmp;

            /* Swap the lengths */
            len_ = other.len_;
            other.len_ = len;
        }

        void flip()
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Allocate temporary memory */
            T* tmp = new T[len_];

            /* Fill the temporary memory */
            std::copy(begin(), end(), &amp;tmp[0]);

            /* Loop and flip the array */
            for (register u32 i = 0; i &lt; len_; ++i)
                data_[i] = tmp[len_ - i - 1];

            /* Delete the temorary memory */
            delete [] tmp;
        }

        void unique()
        {
            /* Loop the data - main */
            for (register u32 i = 0, j; i &lt; len_; ++i)
            {
                /* Loop the data - sub */
                for (j = 0; j &lt; len_;)
                {
                    if (i != j &amp;&amp; data_[i] == data_[j])
                        erase(begin() + j);
                    else
                        ++j;
                }
            }
        }

        void sort()
        {
            /* Check if the data is not empty */
            if (!data_)
                return;

            /* Loop the data - main */
            for (register u32 i = 0, j; i &lt; len_; ++i)
            {
                /* Loop the data - sub */
                for (j = 0; j &lt; len_; ++j)
                {
                    /* Check which value is smaller */
                    if (data_[i] &lt; data_[j] &amp;&amp; i != j)
                    {
                        /* Then move it before the element with the bigger value */
                        move(begin()+i, begin()+i, begin()+j);
                    }
                }
            }
        }

    private:

        /* Members */

        T* data_;

        u32 len_;

};

} // /namespace math

#endif
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1552927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552927</guid><dc:creator><![CDATA[LukasBanana]]></dc:creator><pubDate>Thu, 24 Jul 2008 10:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 10:54:38 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef T* const    const_iterator;
</code></pre>
<p>Argh! Ich weiß nicht, ob du das Konzept von Iteratoren schon verstanden hast. Lies mal <a href="http://www.mochima.com/tutorials/STL.html#A_Little_More_on_Iterators" rel="nofollow">das</a>.</p>
<p>EDIT:<br />
Ich mach dir mal ne Liste von WTFs in deinem Code. Es besteht allerdings keine Grantie auf Vollständigkeit.</p>
<pre><code class="language-cpp">1.) #ifndef __MATH_CONTAINER__
2.) #include &lt;math.h&gt;
3.) Wozu die typedefs? Wenn dann in der Klasse selbst.
4.) typedef T* const    const_iterator;
5.) bool operator == (array&lt;T&gt; other) // Deklaration + Definition
6.) bool operator != (array&lt;T&gt; other) // Deklaration + Definition
7.) array&lt;T&gt;&amp; operator = (const array&lt;T&gt; &amp;other) // Selbstzuweisung?
8.) bool empty() // Deklaration
9.) u32 size() // Deklaration
10.) const_iterator begin() // Deklaration, einzige Version?
11.) const_iterator end() // Deklaration, einzige Version?
12.) std::fill(begin(), end(), (T)0); // Beachte, dass begin() + end() bei dir eig. const_iteratoren sind, (T)0 ? User defined types?
13.) if (data_) delete [] data_; // doppelt-gemoppelt hält besser, was?
14.) void erase(const_iterator begin, const_iterator end) // Folge-Fehler
15.) void swap(array&lt;T&gt; &amp;other) // Viel zu umständlich, könnte ein Zwei-Zeiler sein.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1552931</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552931</guid><dc:creator><![CDATA[Don06]]></dc:creator><pubDate>Thu, 24 Jul 2008 10:54:38 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 10:41:28 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>MontagMorgen schrieb:</p>
<blockquote>
<pre><code class="language-cpp">class math : public std::vector&lt;T&gt;{};
</code></pre>
</blockquote>
<p>Es gab hier schon mehrere Diskussionen darüber, dass man nicht von STL-Containern erben sollte (u.a. wegen nicht vorhandenem virtuellen Destruktor).</p>
</blockquote>
<p>Das sollte meines Erachtens gerade ein Beispiel sein, in dem man es darf (weil die abgeleitete Klasse keine Membervariablen hat und ihr Destruktor damit trivial ist). Damit sie benutzbar ist, sollten aber noch die Konstruktoren implementiert sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1552936</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552936</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Thu, 24 Jul 2008 10:41:28 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 10:46:27 GMT]]></title><description><![CDATA[<p>Nimm mal deinen RL-Namen aus dem Sourcecode hier raus <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> Reale Existenzen haben im Internet nix zu suchen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1552939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552939</guid><dc:creator><![CDATA[It0101]]></dc:creator><pubDate>Thu, 24 Jul 2008 10:46:27 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 11:10:23 GMT]]></title><description><![CDATA[<p>.filmor schrieb:</p>
<blockquote>
<p>Das sollte meines Erachtens gerade ein Beispiel sein, in dem man es darf (weil die abgeleitete Klasse keine Membervariablen hat und ihr Destruktor damit trivial ist).</p>
</blockquote>
<p>Das konstituiert keinen trivialen Destruktor. Ein trivialer Destruktor ist an dieser Stelle ohnehin kein Kriterium.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1552954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552954</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 24 Jul 2008 11:10:23 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 11:45:50 GMT]]></title><description><![CDATA[<p>Sondern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1552970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552970</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Thu, 24 Jul 2008 11:45:50 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 12:01:01 GMT]]></title><description><![CDATA[<p>[unsinn]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1552976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1552976</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 24 Jul 2008 12:01:01 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 15:20:49 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13710">@Don06</a></p>
<pre><code>array&lt;T&gt;&amp; operator = (const array&lt;T&gt; &amp;other) // Selbstzuweisung?
</code></pre>
<p>alternative??</p>
<p>Grüüüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1553111</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1553111</guid><dc:creator><![CDATA[zeusosc]]></dc:creator><pubDate>Thu, 24 Jul 2008 15:20:49 GMT</pubDate></item><item><title><![CDATA[Reply to Was haltet ihr von meiner eigenen CONTAINER Klasse? on Thu, 24 Jul 2008 15:55:53 GMT]]></title><description><![CDATA[<p>zeusosc schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13710">@Don06</a></p>
<pre><code>array&lt;T&gt;&amp; operator = (const array&lt;T&gt; &amp;other) // Selbstzuweisung?
</code></pre>
<p>alternative??</p>
<p>Grüüüße</p>
</blockquote>
<p>Don06 meinte damit wohl das eine mögliche Selbstzuweisung aktuell nicht behandelt wird.</p>
<p>Edit:<br />
Was mir nach auffiel</p>
<p>o <em>array(u32 size)</em> sollte explizit sein<br />
o Vergleichsoperatoren halte ich für unnötig<br />
o Die Const-Correctness wurde nicht konsequent eingehalten (z.B. <em>size()</em>)<br />
o Die &quot;Wachstumsstrategie&quot; ist weniger optimal (viel zu viel Allokationen)<br />
o Kein Kopierkonstruktor<br />
o Kein korrektes Exceptionhandling, gerade bei Neuanforderung von Speicher. Das kann schnell zu ungültigen Zeigern und haufwenweisen Problemen führen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1553119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1553119</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Thu, 24 Jul 2008 15:55:53 GMT</pubDate></item></channel></rss>