<?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[&amp;lt;type&amp;gt; is not derived from &amp;lt;type&amp;gt;]]></title><description><![CDATA[<p>Hoi <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Ich hab ein Problem das mich absolut stutzig macht:</p>
<p>Erst mal der Code:</p>
<pre><code class="language-cpp">/**
   * Class used to iterate over a list of processes
   */
   template &lt;typename Info&gt;
   class basic_enum_process
   {
   private:
      std::vector&lt;Info&gt; m_snap;

   public:
      /**
      * Default ctor
      */
      basic_enum_process() : m_snap(0)
      { }

      /**
      * Optional constructor calling make_snapshot()
      * @argument Ignored as a pid is senseless in this context
      */
      basic_enum_process(pid_t)
      {
         make_snapshot(0);
      }

      /**
      * Makes a snapshot of all running processes
      * @argument Ignored as a pid is senseless in this context
      */
      void make_snapshot(pid_t = 0)
      {
         impl::make_process_snapshot&lt;Info&gt;(m_snap);
      }

      /**
      * Returns an iterator to the first element in the snapshot
      */
      std::vector&lt;Info&gt;::const_iterator begin() const
      {
         return m_snap.begin();
      }

      /**
      * Returns an iterator to the last element in the snapshot
      */
      std::vector&lt;Info&gt;::const_iterator end() const
      {
         return m_snap.end();
      }

      /**
      * Returns the amount of snapped processes
      */
      size_t get_amount() const
      {
         return m_snap.size();
      }

      /**
      * Frees memory allocated for snapshot
      */
      void free_memory() const
      {
         m_snap.clear();
      }

   };
</code></pre>
<p>Aus welchem Grund haut mir der Compiler bei dem Code die Fehlermeldung um die Ohren</p>
<pre><code>system_snapshots.hpp:61: error: type ‘std::vector&lt;Info, std::allocator&lt;_Tp1&gt; &gt;’ is not derived from type ‘memworm::basic_enum_process&lt;Info&gt;’
</code></pre>
<p>bei dem Versuch die Iteratoren zureückzugeben?</p>
<p>Grüße,<br />
Flo</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/278806/lt-type-gt-is-not-derived-from-lt-type-gt</link><generator>RSS for Node</generator><lastBuildDate>Tue, 25 Aug 2026 01:23:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/278806.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 13 Dec 2010 14:18:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &amp;lt;type&amp;gt; is not derived from &amp;lt;type&amp;gt; on Mon, 13 Dec 2010 14:18:34 GMT]]></title><description><![CDATA[<p>Hoi <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Ich hab ein Problem das mich absolut stutzig macht:</p>
<p>Erst mal der Code:</p>
<pre><code class="language-cpp">/**
   * Class used to iterate over a list of processes
   */
   template &lt;typename Info&gt;
   class basic_enum_process
   {
   private:
      std::vector&lt;Info&gt; m_snap;

   public:
      /**
      * Default ctor
      */
      basic_enum_process() : m_snap(0)
      { }

      /**
      * Optional constructor calling make_snapshot()
      * @argument Ignored as a pid is senseless in this context
      */
      basic_enum_process(pid_t)
      {
         make_snapshot(0);
      }

      /**
      * Makes a snapshot of all running processes
      * @argument Ignored as a pid is senseless in this context
      */
      void make_snapshot(pid_t = 0)
      {
         impl::make_process_snapshot&lt;Info&gt;(m_snap);
      }

      /**
      * Returns an iterator to the first element in the snapshot
      */
      std::vector&lt;Info&gt;::const_iterator begin() const
      {
         return m_snap.begin();
      }

      /**
      * Returns an iterator to the last element in the snapshot
      */
      std::vector&lt;Info&gt;::const_iterator end() const
      {
         return m_snap.end();
      }

      /**
      * Returns the amount of snapped processes
      */
      size_t get_amount() const
      {
         return m_snap.size();
      }

      /**
      * Frees memory allocated for snapshot
      */
      void free_memory() const
      {
         m_snap.clear();
      }

   };
</code></pre>
<p>Aus welchem Grund haut mir der Compiler bei dem Code die Fehlermeldung um die Ohren</p>
<pre><code>system_snapshots.hpp:61: error: type ‘std::vector&lt;Info, std::allocator&lt;_Tp1&gt; &gt;’ is not derived from type ‘memworm::basic_enum_process&lt;Info&gt;’
</code></pre>
<p>bei dem Versuch die Iteratoren zureückzugeben?</p>
<p>Grüße,<br />
Flo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1993786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1993786</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Mon, 13 Dec 2010 14:18:34 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;lt;type&amp;gt; is not derived from &amp;lt;type&amp;gt; on Mon, 13 Dec 2010 14:32:42 GMT]]></title><description><![CDATA[<p>typename davor schreiben. Der Compiler weiß nicht, was ein <code>std::vector&lt;Info&gt;::const_iterator</code> ist, wenn du es ihm nicht explizit sagst, da er noch nicht weiß, was <code>Info</code> ist. Könnte ja auch eine Zahl oder ein Funktionszeiger oder sonstwas sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1993798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1993798</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 13 Dec 2010 14:32:42 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;lt;type&amp;gt; is not derived from &amp;lt;type&amp;gt; on Mon, 13 Dec 2010 15:00:58 GMT]]></title><description><![CDATA[<p>Upps, danke!</p>
<p>Kanns sein dass der MSVC++ das aber trotzdem kompiliert?<br />
Früher habe ich es eigentlich immer so geschrieben, bin GCC Neuling <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1993812</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1993812</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Mon, 13 Dec 2010 15:00:58 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;lt;type&amp;gt; is not derived from &amp;lt;type&amp;gt; on Mon, 13 Dec 2010 15:27:54 GMT]]></title><description><![CDATA[<p>Ethon schrieb:</p>
<blockquote>
<p>Kanns sein dass der MSVC++ das aber trotzdem kompiliert?<br />
Früher habe ich es eigentlich immer so geschrieben, bin GCC Neuling <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>Ja, kann sein. Soweit ich weiß, macht MSVC++ kein richtiges Zwei-Phasen-Lookup. Das 'typename' hier wegzulassen ist aber nicht erlaubt. Der GCC ist da recht pingelig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1993832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1993832</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Mon, 13 Dec 2010 15:27:54 GMT</pubDate></item></channel></rss>