<?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[numeric_limtis]]></title><description><![CDATA[<p>std::numeric_limits&lt;T&gt;::is_integer - true if type is integer.<br />
std::numeric_limits&lt;T&gt;::is_exact - true if type uses exact representations.<br />
wo ist da der unterschied?</p>
<p>und angenommen ich scheibe selbst eine numerische klasse, darf ich dann numeric_limits im std-namensbereich spezialisieren und da die attribute meiner klasse eintragen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/320892/numeric_limtis</link><generator>RSS for Node</generator><lastBuildDate>Thu, 23 Jul 2026 20:47:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/320892.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Oct 2013 09:21:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 09:21:07 GMT]]></title><description><![CDATA[<p>std::numeric_limits&lt;T&gt;::is_integer - true if type is integer.<br />
std::numeric_limits&lt;T&gt;::is_exact - true if type uses exact representations.<br />
wo ist da der unterschied?</p>
<p>und angenommen ich scheibe selbst eine numerische klasse, darf ich dann numeric_limits im std-namensbereich spezialisieren und da die attribute meiner klasse eintragen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2360647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360647</guid><dc:creator><![CDATA[is_confused]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:21:07 GMT</pubDate></item><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 09:24:18 GMT]]></title><description><![CDATA[<blockquote>
<p>numeric_limits im std-namensbereich spezialisieren</p>
</blockquote>
<p>Nein, unter Vorbehalt.</p>
<blockquote>
<p>std::numeric_limits&lt;T&gt;::is_integer - true if type is integer.<br />
std::numeric_limits&lt;T&gt;::is_exact - true if type uses exact representations.<br />
wo ist da der unterschied?</p>
</blockquote>
<p>A sagt semantisch was anderes als B. Ich kann exakt sein, ohne dass ich Integer bin. Was sagt erstes und letzteres zu ratio?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2360648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360648</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:24:18 GMT</pubDate></item><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 09:46:20 GMT]]></title><description><![CDATA[<blockquote>
<p>numeric_limits im std-namensbereich spezialisieren</p>
</blockquote>
<p>Ja, das darfst du für eigene Typen.</p>
<p>§17.6.4.2.1/1 schrieb:</p>
<blockquote>
<p>A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.</p>
</blockquote>
<p>Allerdings gibt es für <code>numeric_limits</code> eine Ausnahme:</p>
<p>§18.3.2.1/4 schrieb:</p>
<blockquote>
<p>Non-arithmetic standard types, such as complex&lt;T&gt;, shall not have specializations.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2360654</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360654</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:46:20 GMT</pubDate></item><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 09:50:55 GMT]]></title><description><![CDATA[<p>knivil schrieb:</p>
<blockquote>
<p>Was sagt erstes und letzteres zu ratio?</p>
</blockquote>
<p>mein compiler hat keinen vollen c++11 support.</p>
<p>Arcoth schrieb:</p>
<blockquote>
<p>Allerdings gibt es für <code>numeric_limits</code> eine Ausnahme:</p>
<p>§18.3.2.1/4 schrieb:</p>
<blockquote>
<p>Non-arithmetic standard types, such as complex&lt;T&gt;, shall not have specializations.</p>
</blockquote>
</blockquote>
<p>ich bin mir nicht sicher ob ich das richtig verstehe. also numeric_limits darf einfach für std-member nicht überladen werden, ja? und complex&lt;T&gt; ist doch ein arithmetischer typ, zumindest simuliert er arithmetisches verhalten...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2360657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360657</guid><dc:creator><![CDATA[is_confused]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:50:55 GMT</pubDate></item><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 09:58:46 GMT]]></title><description><![CDATA[<p>Nein, <code>complex&lt;T&gt;</code> ist kein arithmetischer Typ, sondern eine Klasse. Zumindest nach Standard. Arithmetische Typen sind <code>float</code> , <code>int</code> , <code>double</code> , <code>char</code> , usw.</p>
<blockquote>
<p>ich bin mir nicht sicher ob ich das richtig verstehe. also numeric_limits darf einfach für std-member nicht überladen werden, ja?</p>
</blockquote>
<p>So ist es.</p>
<blockquote>
<p>mein compiler hat keinen vollen c++11 support.</p>
</blockquote>
<p>Es ging ja nur ums Beispiel.</p>
<p>Übrigens, genau aus meiner oben genannten Ausnahme ist Knivils Tipp Unfug.</p>
<pre><code>#include &lt;ratio&gt;
#include &lt;limits&gt;
static_assert( std::numeric_limits&lt;std::milli&gt;::is_specialized, &quot;&quot; ); // schlägt natürlich fehl
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2360660</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360660</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:58:46 GMT</pubDate></item><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 10:04:16 GMT]]></title><description><![CDATA[<blockquote>
<p>Übrigens, genau aus meiner oben genannten Ausnahme ist Knivils Tipp Unfug.</p>
</blockquote>
<p>Welcher Tip?</p>
<p><a href="http://en.cppreference.com/w/cpp/types/numeric_limits/is_exact" rel="nofollow">http://en.cppreference.com/w/cpp/types/numeric_limits/is_exact</a> :</p>
<blockquote>
<p>While all fundamental types T for which std::numeric_limits&lt;T&gt;::is_exact==true are integer types, a library may define exact types that aren't integers, e.g. a rational arithmetics type representing fractions.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2360662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360662</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Wed, 16 Oct 2013 10:04:16 GMT</pubDate></item><item><title><![CDATA[Reply to numeric_limtis on Wed, 16 Oct 2013 10:06:27 GMT]]></title><description><![CDATA[<p>Ach, ich dachte, du meinst ganz konkret <code>std::ratio</code> . <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="🙂"
    /> Natürlich, Bruchklassen sind ein gutes Beispiel.<br />
(Das Problem wäre, dass die unspezialisierte Version immer noch alle Member hat, und man dann trotzdem auf sie zugreifen kann - auch wenn sie falsche Werte haben)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2360664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2360664</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 16 Oct 2013 10:06:27 GMT</pubDate></item></channel></rss>