<?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[C++11-Code nach C++03 umschreiben]]></title><description><![CDATA[<p>Hi, wie kann ich den folgenden Code in C++03 formulieren?</p>
<pre><code>template&lt;typename integral_t, typename = typename std::enable_if&lt;std::is_integral&lt;integral_t&gt;::value&gt;::type&gt;
bool f(integral_t value)
{
	...
}
</code></pre>
<p>Ich brauche das weil ich den Code auf einem alten Compiler zum Laufen bringen muss.<br />
Bisher hab ich:</p>
<pre><code>template&lt;bool condition, typename t = void&gt;
struct enable_if;
template&lt;typename t&gt;
struct enable_if&lt;true, t&gt;
{
	typedef t type;
};

template&lt;typename lhs, typename rhs&gt;
struct same
{
	static const bool value = false;
};
template&lt;typename t&gt;
struct same&lt;t, t&gt;
{
	static const bool value = true;
};

template&lt;typename t&gt;
struct is_integral
{
	static const bool value = same&lt;t, bool&gt;::value || ... ;
};
</code></pre>
<p>Wie ich das aber so in den Code der Funktion bauen soll ist mir schleierhaft.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/326745/c-11-code-nach-c-03-umschreiben</link><generator>RSS for Node</generator><lastBuildDate>Tue, 26 May 2026 14:29:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/326745.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 Jul 2014 11:18:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++11-Code nach C++03 umschreiben on Sat, 05 Jul 2014 11:18:09 GMT]]></title><description><![CDATA[<p>Hi, wie kann ich den folgenden Code in C++03 formulieren?</p>
<pre><code>template&lt;typename integral_t, typename = typename std::enable_if&lt;std::is_integral&lt;integral_t&gt;::value&gt;::type&gt;
bool f(integral_t value)
{
	...
}
</code></pre>
<p>Ich brauche das weil ich den Code auf einem alten Compiler zum Laufen bringen muss.<br />
Bisher hab ich:</p>
<pre><code>template&lt;bool condition, typename t = void&gt;
struct enable_if;
template&lt;typename t&gt;
struct enable_if&lt;true, t&gt;
{
	typedef t type;
};

template&lt;typename lhs, typename rhs&gt;
struct same
{
	static const bool value = false;
};
template&lt;typename t&gt;
struct same&lt;t, t&gt;
{
	static const bool value = true;
};

template&lt;typename t&gt;
struct is_integral
{
	static const bool value = same&lt;t, bool&gt;::value || ... ;
};
</code></pre>
<p>Wie ich das aber so in den Code der Funktion bauen soll ist mir schleierhaft.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2407090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407090</guid><dc:creator><![CDATA[Abwärtskompatibel]]></dc:creator><pubDate>Sat, 05 Jul 2014 11:18:09 GMT</pubDate></item><item><title><![CDATA[Reply to C++11-Code nach C++03 umschreiben on Sat, 05 Jul 2014 11:31:12 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template&lt;typename T&gt;
typename std::enable_if&lt;std::is_integral&lt;T&gt;::value, bool&gt;::type f(T value);
// oder
template&lt;typename T&gt;
bool f(T value, typename std::enable_if&lt;std::is_integral&lt;T&gt;::value&gt;::type* = 0);
</code></pre>
<p>Ersteres ist nach Möglichkeit vorzuziehen, Letzteres ist die einzige Möglichkeit bei Konstruktoren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2407091</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407091</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 05 Jul 2014 11:31:12 GMT</pubDate></item><item><title><![CDATA[Reply to C++11-Code nach C++03 umschreiben on Sat, 05 Jul 2014 11:35:58 GMT]]></title><description><![CDATA[<p>Danke. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2407092</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2407092</guid><dc:creator><![CDATA[Abwärtskompatibel]]></dc:creator><pubDate>Sat, 05 Jul 2014 11:35:58 GMT</pubDate></item></channel></rss>