<?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[template class in member function]]></title><description><![CDATA[<p>hallo leute</p>
<p>wie sieht es mit template-klassen in member funktionen aus ? gibt es da bestimmte beschränkungen ?</p>
<p>folgende template-klasse:</p>
<pre><code>template&lt;class CHAR_TYPE&gt;
class property_runtime_information : public IRuntimeInformation
{
   public:
      virtual auto __stdcall ClassName(void) const noexcept -&gt; const char*
      {
         template&lt;class CHAR_TYPE&gt;;

         template&lt;&gt; 
         struct property_class_name&lt;char&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;char&gt;&quot;; 
         };

         template&lt;&gt; 
         struct property_class_name&lt;unsigned char&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned char&gt;&quot;; 
         };

         template&lt;&gt; 
         struct property_class_name&lt;wchar_t&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;wchar_t&gt;&quot;; 
         };

         template&lt;&gt; 
         struct property_class_name&lt;unsigned int&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned int&gt;&quot;; 
         };

         return property_class_name&lt;CHAR_TYPE&gt;::string;
      }

      virtual auto __stdcall Size(void) const noexcept -&gt; size_type
      {
         return sizeof(basic_property&lt;CHAR_TYPE&gt;);
      }

      virtual auto __stdcall IsCloneable(void) const noexcept -&gt; bool
      {
         return true;
      }
}; /* class property_runtime_information */

template&lt;class CHAR_TYPE&gt;
inline auto basic_property&lt;CHAR_TYPE&gt;::RuntimeInformation(void) const noexcept -&gt; const IRuntimeInformation *
{
   static const property_runtime_information&lt;CHAR_TYPE&gt; ri;

   return &amp;ri;
}
</code></pre>
<p>als eigenstaendige klasse in einem namespace gibt es kein problem.<br />
in einer member-funktion einer template-klasse gibt es allerdings einen fehler:</p>
<pre><code>template&lt;class CHAR_TYPE&gt;
inline auto basic_property&lt;CHAR_TYPE&gt;::RuntimeInformation(void) const noexcept -&gt; const IRuntimeInformation *
{
   template&lt;class CHAR_TYPE&gt;
   class property_runtime_information : public IRuntimeInformation
   {
      public:
         virtual auto __stdcall ClassName(void) const noexcept -&gt; const char*
         {
            template&lt;class CHAR_TYPE&gt;;

            template&lt;&gt; 
            struct property_class_name&lt;char&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;char&gt;&quot;; 
            };

            template&lt;&gt; 
            struct property_class_name&lt;unsigned char&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned char&gt;&quot;; 
            };

            template&lt;&gt; 
            struct property_class_name&lt;wchar_t&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;wchar_t&gt;&quot;; 
            };

            template&lt;&gt; 
            struct property_class_name&lt;unsigned int&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned int&gt;&quot;; 
            };

            return property_class_name&lt;CHAR_TYPE&gt;::string;
         }

         virtual auto __stdcall Size(void) const noexcept -&gt; size_type
         {
            return sizeof(basic_property&lt;CHAR_TYPE&gt;);
         }

         virtual auto __stdcall IsCloneable(void) const noexcept -&gt; bool
         {
            return true;
         }
   }; /* class property_runtime_information */

   static const property_runtime_information&lt;CHAR_TYPE&gt; ri;

   return &amp;ri;
}
</code></pre>
<p>Fehler:</p>
<pre><code>1&gt; property.xpe.hpp(323): error C2440: &quot;return&quot;: &quot;const xpe::basic_property&lt;unsigned int&gt;::RuntimeInformation::property_runtime_information&lt;CHAR_TYPE&gt; *&quot; kann nicht in &quot;const xpe::IRuntimeInformation *&quot; konvertiert werden
1&gt;          with
1&gt;          [
1&gt;              CHAR_TYPE=unsigned int
1&gt;          ]
1&gt; property.xpe.hpp(323): note: Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
</code></pre>
<p>woran liegt das ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/339700/template-class-in-member-function</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 02:02:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/339700.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Sep 2016 07:16:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template class in member function on Wed, 21 Sep 2016 07:20:11 GMT]]></title><description><![CDATA[<p>hallo leute</p>
<p>wie sieht es mit template-klassen in member funktionen aus ? gibt es da bestimmte beschränkungen ?</p>
<p>folgende template-klasse:</p>
<pre><code>template&lt;class CHAR_TYPE&gt;
class property_runtime_information : public IRuntimeInformation
{
   public:
      virtual auto __stdcall ClassName(void) const noexcept -&gt; const char*
      {
         template&lt;class CHAR_TYPE&gt;;

         template&lt;&gt; 
         struct property_class_name&lt;char&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;char&gt;&quot;; 
         };

         template&lt;&gt; 
         struct property_class_name&lt;unsigned char&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned char&gt;&quot;; 
         };

         template&lt;&gt; 
         struct property_class_name&lt;wchar_t&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;wchar_t&gt;&quot;; 
         };

         template&lt;&gt; 
         struct property_class_name&lt;unsigned int&gt; 
         { 
            static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned int&gt;&quot;; 
         };

         return property_class_name&lt;CHAR_TYPE&gt;::string;
      }

      virtual auto __stdcall Size(void) const noexcept -&gt; size_type
      {
         return sizeof(basic_property&lt;CHAR_TYPE&gt;);
      }

      virtual auto __stdcall IsCloneable(void) const noexcept -&gt; bool
      {
         return true;
      }
}; /* class property_runtime_information */

template&lt;class CHAR_TYPE&gt;
inline auto basic_property&lt;CHAR_TYPE&gt;::RuntimeInformation(void) const noexcept -&gt; const IRuntimeInformation *
{
   static const property_runtime_information&lt;CHAR_TYPE&gt; ri;

   return &amp;ri;
}
</code></pre>
<p>als eigenstaendige klasse in einem namespace gibt es kein problem.<br />
in einer member-funktion einer template-klasse gibt es allerdings einen fehler:</p>
<pre><code>template&lt;class CHAR_TYPE&gt;
inline auto basic_property&lt;CHAR_TYPE&gt;::RuntimeInformation(void) const noexcept -&gt; const IRuntimeInformation *
{
   template&lt;class CHAR_TYPE&gt;
   class property_runtime_information : public IRuntimeInformation
   {
      public:
         virtual auto __stdcall ClassName(void) const noexcept -&gt; const char*
         {
            template&lt;class CHAR_TYPE&gt;;

            template&lt;&gt; 
            struct property_class_name&lt;char&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;char&gt;&quot;; 
            };

            template&lt;&gt; 
            struct property_class_name&lt;unsigned char&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned char&gt;&quot;; 
            };

            template&lt;&gt; 
            struct property_class_name&lt;wchar_t&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;wchar_t&gt;&quot;; 
            };

            template&lt;&gt; 
            struct property_class_name&lt;unsigned int&gt; 
            { 
               static constexpr const char *string = &quot;xpe::basic_property&lt;unsigned int&gt;&quot;; 
            };

            return property_class_name&lt;CHAR_TYPE&gt;::string;
         }

         virtual auto __stdcall Size(void) const noexcept -&gt; size_type
         {
            return sizeof(basic_property&lt;CHAR_TYPE&gt;);
         }

         virtual auto __stdcall IsCloneable(void) const noexcept -&gt; bool
         {
            return true;
         }
   }; /* class property_runtime_information */

   static const property_runtime_information&lt;CHAR_TYPE&gt; ri;

   return &amp;ri;
}
</code></pre>
<p>Fehler:</p>
<pre><code>1&gt; property.xpe.hpp(323): error C2440: &quot;return&quot;: &quot;const xpe::basic_property&lt;unsigned int&gt;::RuntimeInformation::property_runtime_information&lt;CHAR_TYPE&gt; *&quot; kann nicht in &quot;const xpe::IRuntimeInformation *&quot; konvertiert werden
1&gt;          with
1&gt;          [
1&gt;              CHAR_TYPE=unsigned int
1&gt;          ]
1&gt; property.xpe.hpp(323): note: Die Typen, auf die verwiesen wird, sind nicht verknüpft; die Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat.
</code></pre>
<p>woran liegt das ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2509245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2509245</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Wed, 21 Sep 2016 07:20:11 GMT</pubDate></item><item><title><![CDATA[Reply to template class in member function on Wed, 21 Sep 2016 07:33:48 GMT]]></title><description><![CDATA[<p>Meep Meep schrieb:</p>
<blockquote>
<p>hallo leute</p>
<p>wie sieht es mit template-klassen in member funktionen aus ?</p>
</blockquote>
<p>Klar. Templatedeklarationen dürfen nur auf Namensraumebene oder in einer Klassendefinition auftreten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2509246</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2509246</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 21 Sep 2016 07:33:48 GMT</pubDate></item><item><title><![CDATA[Reply to template class in member function on Wed, 21 Sep 2016 11:05:23 GMT]]></title><description><![CDATA[<pre><code>template&lt;class CHAR_TYPE&gt;;
</code></pre>
<p>Hä?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2509275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2509275</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 21 Sep 2016 11:05:23 GMT</pubDate></item><item><title><![CDATA[Reply to template class in member function on Wed, 21 Sep 2016 15:21:29 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<pre><code>template&lt;class CHAR_TYPE&gt;;
</code></pre>
<p>Hä?</p>
</blockquote>
<p>ja da is beim kopieren was schief gegangen.</p>
<p>heisst natuerlich</p>
<pre><code>template&lt;class CHAR_TYPE&gt; struct property_class_name;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2509295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2509295</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Wed, 21 Sep 2016 15:21:29 GMT</pubDate></item></channel></rss>