<?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[problem mit template klasse als template parameter]]></title><description><![CDATA[<pre><code class="language-cpp">//! \brief  Helper template to remove __w64 qualifier from a type
    template&lt;typename T&gt; struct RemoveWarning64 { typedef T type; };
    template&lt;&gt; struct RemoveWarning64&lt; int &gt;
    {
        typedef int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const int &gt;
    {
        typedef const int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; volatile int &gt;
    {
        typedef volatile int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const volatile int &gt;
    {
        typedef const volatile int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; long &gt;
    {
        typedef long type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const long &gt;
    {
        typedef const long type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; volatile long &gt;
    {
        typedef volatile long type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const volatile long &gt;
    {
        typedef const volatile long type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* &gt;
    {
        typedef typename boost::add_pointer&lt; T &gt;::type type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* const &gt;
    {
        typedef const typename boost::add_pointer&lt; T &gt;::type type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* volatile &gt;
    {
        typedef volatile typename boost::add_pointer&lt; T &gt;::type type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* const volatile &gt;
    {
        typedef const volatile typename boost::add_pointer&lt; T &gt;::type type;
    };
    //! \brief  Helper template which applies all cv qualifiers of two given
    //!         types to the first type.
    template&lt;typename T, typename U&gt;
    struct UniteCvQualifiers
    {
        typedef typename boost::mpl::apply_wrap4&lt; boost::mpl::arg&lt; 
            boost::is_volatile&lt; U &gt;::value
                ? boost::is_const&lt; U &gt;::value
                    ? 4
                    : 3
                : boost::is_const&lt; U &gt;::value
                    ? 2
                    : 1
            &gt;,
            typename RemoveWarning64&lt; T &gt;::type,
            typename RemoveWarning64&lt; const T &gt;::type,
            typename RemoveWarning64&lt; volatile T &gt;::type,
            typename RemoveWarning64&lt; const volatile T &gt;::type &gt;::type type;
    };

    struct NoType {};
    struct YesType { NoType dummy_[ 2 ]; };
    //! Helper template to determine the type of given expression
    template&lt;typename X, typename Y&gt;
    struct Z
    {
        static YesType isLeftType(const X&amp;);
        static NoType isLeftType(const Y&amp;);
    };
    template&lt;typename X&gt;
    struct Z&lt; X, X &gt;
    {
        static YesType isLeftType(const X&amp;);
    };
    template&lt;typename T, typename U&gt;
    struct MinMaxResult
    {
    public:
        typedef typename RemoveWarning64&lt; typename boost::remove_cv&lt; T &gt;::type &gt;::type T_;
        typedef typename RemoveWarning64&lt; typename boost::remove_cv&lt; U &gt;::type &gt;::type U_;
        static T_ createT_();
        static U_ createU_();
    public:
        typedef typename boost::mpl::apply_wrap4&lt;
            boost::mpl::arg&lt;
                boost::is_same&lt; T_, U_ &gt;::value
                    ? boost::is_volatile&lt; T &gt;::value || boost::is_volatile&lt; U &gt;::value
                        ? 1
                        : 4
                    : boost::is_integral&lt; T_ &gt;::value &amp;&amp; boost::is_integral&lt; U_ &gt;::value
                        ? boost::is_same&lt; T_, char &gt;::value || boost::is_same&lt; U_, char &gt;::value
                            ? 1
                            : std::numeric_limits&lt; T_ &gt;::is_signed == std::numeric_limits&lt; U_ &gt;::is_signed
                                ? sizeof( typename Z&lt; T_, U_ &gt;::isLeftType( true ? createT_() : createU_() ) )
                                                                                        == sizeof( YesType )
                                    ? 2
                                    : 3
                                : 1
                        : boost::is_float&lt; T_ &gt;::value &amp;&amp; boost::is_float&lt; U_ &gt;::value
                            ? sizeof( typename Z&lt; T_, U_ &gt;::isLeftType( true ? createT_() : createU_() ) )
                                                                                        == sizeof( YesType )
                                ? 2
                                : 3
                            : boost::is_pointer&lt; T_ &gt;::value &amp;&amp; boost::is_pointer&lt; U_ &gt;::value
                                ? boost::is_base_and_derived&lt; typename boost::remove_pointer&lt; T_ &gt;::type,
                                                              typename boost::remove_pointer&lt; U_ &gt;::type &gt;::value
                                    ? 2
                                    : boost::is_base_and_derived&lt; typename boost::remove_pointer&lt; U_ &gt;::type,
                                                                  typename boost::remove_pointer&lt; T_ &gt;::type &gt;::value
                                          ? 3
                                          : 1
                                : 1
            &gt;,
            NoType, T_, U_, typename RemoveWarning64&lt; typename UniteCvQualifiers&lt; T, U &gt;::type &gt;::type
        &gt;::type type; // &lt;===============================
    };
</code></pre>
<p>da bekomme ich in der markierten zeile:<br />
error C3203: 'arg' : class template invalid as template argument for template parameter 'F', expected a real type</p>
<p>ist bestimmt was simples, aber irgendwie entgeht es mir, schiesslich ist arg&lt; ... &gt; eine klasse und kein template</p>
<p>irgendwelche ideen dazu sind willkommen. bestimmt kann man das ganze auch generell viel einfcher bauen, inspiriert ist das ganze von<br />
<a href="http://erdani.org/publications/cuj-04-2001.html" rel="nofollow">http://erdani.org/publications/cuj-04-2001.html</a><br />
allerdings wollte ich kein loki benutzen und auch einige unsichere kombinationen (z.B. unsigned und signed typen) ausschliessen.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/126138/problem-mit-template-klasse-als-template-parameter</link><generator>RSS for Node</generator><lastBuildDate>Mon, 24 Aug 2026 13:58:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/126138.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 Nov 2005 09:35:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problem mit template klasse als template parameter on Sat, 12 Nov 2005 09:35:04 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">//! \brief  Helper template to remove __w64 qualifier from a type
    template&lt;typename T&gt; struct RemoveWarning64 { typedef T type; };
    template&lt;&gt; struct RemoveWarning64&lt; int &gt;
    {
        typedef int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const int &gt;
    {
        typedef const int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; volatile int &gt;
    {
        typedef volatile int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const volatile int &gt;
    {
        typedef const volatile int type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; long &gt;
    {
        typedef long type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const long &gt;
    {
        typedef const long type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; volatile long &gt;
    {
        typedef volatile long type;
    };
    template&lt;&gt; struct RemoveWarning64&lt; const volatile long &gt;
    {
        typedef const volatile long type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* &gt;
    {
        typedef typename boost::add_pointer&lt; T &gt;::type type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* const &gt;
    {
        typedef const typename boost::add_pointer&lt; T &gt;::type type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* volatile &gt;
    {
        typedef volatile typename boost::add_pointer&lt; T &gt;::type type;
    };
    template&lt;typename T&gt; struct RemoveWarning64&lt; T* const volatile &gt;
    {
        typedef const volatile typename boost::add_pointer&lt; T &gt;::type type;
    };
    //! \brief  Helper template which applies all cv qualifiers of two given
    //!         types to the first type.
    template&lt;typename T, typename U&gt;
    struct UniteCvQualifiers
    {
        typedef typename boost::mpl::apply_wrap4&lt; boost::mpl::arg&lt; 
            boost::is_volatile&lt; U &gt;::value
                ? boost::is_const&lt; U &gt;::value
                    ? 4
                    : 3
                : boost::is_const&lt; U &gt;::value
                    ? 2
                    : 1
            &gt;,
            typename RemoveWarning64&lt; T &gt;::type,
            typename RemoveWarning64&lt; const T &gt;::type,
            typename RemoveWarning64&lt; volatile T &gt;::type,
            typename RemoveWarning64&lt; const volatile T &gt;::type &gt;::type type;
    };

    struct NoType {};
    struct YesType { NoType dummy_[ 2 ]; };
    //! Helper template to determine the type of given expression
    template&lt;typename X, typename Y&gt;
    struct Z
    {
        static YesType isLeftType(const X&amp;);
        static NoType isLeftType(const Y&amp;);
    };
    template&lt;typename X&gt;
    struct Z&lt; X, X &gt;
    {
        static YesType isLeftType(const X&amp;);
    };
    template&lt;typename T, typename U&gt;
    struct MinMaxResult
    {
    public:
        typedef typename RemoveWarning64&lt; typename boost::remove_cv&lt; T &gt;::type &gt;::type T_;
        typedef typename RemoveWarning64&lt; typename boost::remove_cv&lt; U &gt;::type &gt;::type U_;
        static T_ createT_();
        static U_ createU_();
    public:
        typedef typename boost::mpl::apply_wrap4&lt;
            boost::mpl::arg&lt;
                boost::is_same&lt; T_, U_ &gt;::value
                    ? boost::is_volatile&lt; T &gt;::value || boost::is_volatile&lt; U &gt;::value
                        ? 1
                        : 4
                    : boost::is_integral&lt; T_ &gt;::value &amp;&amp; boost::is_integral&lt; U_ &gt;::value
                        ? boost::is_same&lt; T_, char &gt;::value || boost::is_same&lt; U_, char &gt;::value
                            ? 1
                            : std::numeric_limits&lt; T_ &gt;::is_signed == std::numeric_limits&lt; U_ &gt;::is_signed
                                ? sizeof( typename Z&lt; T_, U_ &gt;::isLeftType( true ? createT_() : createU_() ) )
                                                                                        == sizeof( YesType )
                                    ? 2
                                    : 3
                                : 1
                        : boost::is_float&lt; T_ &gt;::value &amp;&amp; boost::is_float&lt; U_ &gt;::value
                            ? sizeof( typename Z&lt; T_, U_ &gt;::isLeftType( true ? createT_() : createU_() ) )
                                                                                        == sizeof( YesType )
                                ? 2
                                : 3
                            : boost::is_pointer&lt; T_ &gt;::value &amp;&amp; boost::is_pointer&lt; U_ &gt;::value
                                ? boost::is_base_and_derived&lt; typename boost::remove_pointer&lt; T_ &gt;::type,
                                                              typename boost::remove_pointer&lt; U_ &gt;::type &gt;::value
                                    ? 2
                                    : boost::is_base_and_derived&lt; typename boost::remove_pointer&lt; U_ &gt;::type,
                                                                  typename boost::remove_pointer&lt; T_ &gt;::type &gt;::value
                                          ? 3
                                          : 1
                                : 1
            &gt;,
            NoType, T_, U_, typename RemoveWarning64&lt; typename UniteCvQualifiers&lt; T, U &gt;::type &gt;::type
        &gt;::type type; // &lt;===============================
    };
</code></pre>
<p>da bekomme ich in der markierten zeile:<br />
error C3203: 'arg' : class template invalid as template argument for template parameter 'F', expected a real type</p>
<p>ist bestimmt was simples, aber irgendwie entgeht es mir, schiesslich ist arg&lt; ... &gt; eine klasse und kein template</p>
<p>irgendwelche ideen dazu sind willkommen. bestimmt kann man das ganze auch generell viel einfcher bauen, inspiriert ist das ganze von<br />
<a href="http://erdani.org/publications/cuj-04-2001.html" rel="nofollow">http://erdani.org/publications/cuj-04-2001.html</a><br />
allerdings wollte ich kein loki benutzen und auch einige unsichere kombinationen (z.B. unsigned und signed typen) ausschliessen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/915709</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/915709</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 12 Nov 2005 09:35:04 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit template klasse als template parameter on Sat, 12 Nov 2005 09:57:55 GMT]]></title><description><![CDATA[<p>Args, das sieht aber übersichtlich aus <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<pre><code class="language-cpp">typedef typename boost::mpl::apply_wrap4&lt;
  boost::mpl::arg&lt;
    ...
  &gt;,//&lt;--
  NoType,
  T_,
  U_,
  RemoveWarning64&lt; UniteCvQualifiers&lt; T, U &gt;::type &gt;::type
&gt;::type type;
</code></pre>
<p>Kann es sein, daß du das arg&lt;...&gt;::<em>type</em> vergessen hast?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/915724</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/915724</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Sat, 12 Nov 2005 09:57:55 GMT</pubDate></item><item><title><![CDATA[Reply to problem mit template klasse als template parameter on Sat, 12 Nov 2005 10:03:37 GMT]]></title><description><![CDATA[<p>das müsste so richtig sein:<br />
<a href="http://www.boost.org/libs/mpl/doc/refmanual/arg.html" rel="nofollow">http://www.boost.org/libs/mpl/doc/refmanual/arg.html</a><br />
es funktioniert in RemoveWarning64 ja auch</p>
<p>ich versuch mich gerade etwas in mpl hereinzufinden, bestimmt geht das ganze auch eleganter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/915725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/915725</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Sat, 12 Nov 2005 10:03:37 GMT</pubDate></item></channel></rss>