<?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[Datentyp zur Laufzeit ermitteln]]></title><description><![CDATA[<p>Ich habe folgende Funktion basierend auf templates, die immer den maximalen Typ zum aktuell verwendeten Datentyp nutzen soll:</p>
<pre><code class="language-cpp">template &lt;class T&gt;
inline T minArrayValue(T * Array, int iArraySize)
{
	T min = std::numeric_limits&lt;double&gt;::max(); 
	for (int i=0; i &lt; iArraySize; i++)
	{			
		min = minValue(min, Array[i]);
	}
	return min;
}
</code></pre>
<p>nur wie ermittle ich zur Laufzeit den Datentyp?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/208028/datentyp-zur-laufzeit-ermitteln</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 10:57:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208028.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Mar 2008 22:02:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Datentyp zur Laufzeit ermitteln on Thu, 13 Mar 2008 22:02:53 GMT]]></title><description><![CDATA[<p>Ich habe folgende Funktion basierend auf templates, die immer den maximalen Typ zum aktuell verwendeten Datentyp nutzen soll:</p>
<pre><code class="language-cpp">template &lt;class T&gt;
inline T minArrayValue(T * Array, int iArraySize)
{
	T min = std::numeric_limits&lt;double&gt;::max(); 
	for (int i=0; i &lt; iArraySize; i++)
	{			
		min = minValue(min, Array[i]);
	}
	return min;
}
</code></pre>
<p>nur wie ermittle ich zur Laufzeit den Datentyp?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1473986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1473986</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Thu, 13 Mar 2008 22:02:53 GMT</pubDate></item><item><title><![CDATA[Reply to Datentyp zur Laufzeit ermitteln on Thu, 13 Mar 2008 22:07:46 GMT]]></title><description><![CDATA[<p>Google mal nach &quot;type_info&quot; und &quot;Run time Type Information&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1473993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1473993</guid><dc:creator><![CDATA[Steef]]></dc:creator><pubDate>Thu, 13 Mar 2008 22:07:46 GMT</pubDate></item><item><title><![CDATA[Reply to Datentyp zur Laufzeit ermitteln on Thu, 13 Mar 2008 22:19:29 GMT]]></title><description><![CDATA[<p>pospiech schrieb:</p>
<blockquote>
<p>nur wie ermittle ich zur Laufzeit den Datentyp?</p>
</blockquote>
<pre><code class="language-cpp">template&lt; class T &gt;
void wer_bin_ich_questionmark( T &amp;X )
{
	string str = &quot;Ich bin&quot;;

	if ( typeid( X ) == typeid( double ) )
	{
		str += &quot; double.\n&quot;;
	}

	if ( typeid( X ) == typeid ( char ) )
	{
		str += &quot; char.\n&quot;;
	}

	if ( typeid( X ) == typeid ( string ) )
	{
		str += &quot; string.\n&quot;;
	}

	cout &lt;&lt; str;
}

int main()
{
	double d;
	char c;
	string s;

	wer_bin_ich_questionmark( d );
	wer_bin_ich_questionmark( c );
	wer_bin_ich_questionmark( s );
	return 0;
}
</code></pre>
<p><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/1473998</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1473998</guid><dc:creator><![CDATA[proggingmania]]></dc:creator><pubDate>Thu, 13 Mar 2008 22:19:29 GMT</pubDate></item><item><title><![CDATA[Reply to Datentyp zur Laufzeit ermitteln on Thu, 13 Mar 2008 22:26:14 GMT]]></title><description><![CDATA[<p>bist du sicher, dass du das erst zur laufzeit wissen musst?</p>
<p>pospiech schrieb:</p>
<blockquote>
<p>Ich habe folgende Funktion basierend auf templates, die immer den maximalen Typ zum aktuell verwendeten Datentyp nutzen soll:</p>
</blockquote>
<p>was ist ein maximaler typ?</p>
<blockquote>
<pre><code class="language-cpp">T min = std::numeric_limits&lt;double&gt;::max();
</code></pre>
</blockquote>
<p>sowas wäre besser:</p>
<pre><code class="language-cpp">T min = std::numeric_limits&lt;T&gt;::max();
</code></pre>
<p>oder verwende statt deiner funktion gleich <code>std::min_element</code> .</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/15036">@proggingmania</a>: genau so etwas will man doch mit templates vermeiden...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474001</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474001</guid><dc:creator><![CDATA[queer_boy]]></dc:creator><pubDate>Thu, 13 Mar 2008 22:26:14 GMT</pubDate></item><item><title><![CDATA[Reply to Datentyp zur Laufzeit ermitteln on Thu, 13 Mar 2008 23:15:14 GMT]]></title><description><![CDATA[<p>queer_boy schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/15036">@proggingmania</a>: genau so etwas will man doch mit templates vermeiden...</p>
</blockquote>
<p>ohh. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1474025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474025</guid><dc:creator><![CDATA[proggingmania]]></dc:creator><pubDate>Thu, 13 Mar 2008 23:15:14 GMT</pubDate></item><item><title><![CDATA[Reply to Datentyp zur Laufzeit ermitteln on Fri, 14 Mar 2008 00:04:25 GMT]]></title><description><![CDATA[<p>Man braucht aber auch gar nicht den maximalen Wert für den Typ. Nimm als Anfangswert für min einfach das erste Array-Element (für size&gt;0).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1474031</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1474031</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Fri, 14 Mar 2008 00:04:25 GMT</pubDate></item></channel></rss>