problem mit template klasse als template parameter
-
//! \brief Helper template to remove __w64 qualifier from a type template<typename T> struct RemoveWarning64 { typedef T type; }; template<> struct RemoveWarning64< int > { typedef int type; }; template<> struct RemoveWarning64< const int > { typedef const int type; }; template<> struct RemoveWarning64< volatile int > { typedef volatile int type; }; template<> struct RemoveWarning64< const volatile int > { typedef const volatile int type; }; template<> struct RemoveWarning64< long > { typedef long type; }; template<> struct RemoveWarning64< const long > { typedef const long type; }; template<> struct RemoveWarning64< volatile long > { typedef volatile long type; }; template<> struct RemoveWarning64< const volatile long > { typedef const volatile long type; }; template<typename T> struct RemoveWarning64< T* > { typedef typename boost::add_pointer< T >::type type; }; template<typename T> struct RemoveWarning64< T* const > { typedef const typename boost::add_pointer< T >::type type; }; template<typename T> struct RemoveWarning64< T* volatile > { typedef volatile typename boost::add_pointer< T >::type type; }; template<typename T> struct RemoveWarning64< T* const volatile > { typedef const volatile typename boost::add_pointer< T >::type type; }; //! \brief Helper template which applies all cv qualifiers of two given //! types to the first type. template<typename T, typename U> struct UniteCvQualifiers { typedef typename boost::mpl::apply_wrap4< boost::mpl::arg< boost::is_volatile< U >::value ? boost::is_const< U >::value ? 4 : 3 : boost::is_const< U >::value ? 2 : 1 >, typename RemoveWarning64< T >::type, typename RemoveWarning64< const T >::type, typename RemoveWarning64< volatile T >::type, typename RemoveWarning64< const volatile T >::type >::type type; }; struct NoType {}; struct YesType { NoType dummy_[ 2 ]; }; //! Helper template to determine the type of given expression template<typename X, typename Y> struct Z { static YesType isLeftType(const X&); static NoType isLeftType(const Y&); }; template<typename X> struct Z< X, X > { static YesType isLeftType(const X&); }; template<typename T, typename U> struct MinMaxResult { public: typedef typename RemoveWarning64< typename boost::remove_cv< T >::type >::type T_; typedef typename RemoveWarning64< typename boost::remove_cv< U >::type >::type U_; static T_ createT_(); static U_ createU_(); public: typedef typename boost::mpl::apply_wrap4< boost::mpl::arg< boost::is_same< T_, U_ >::value ? boost::is_volatile< T >::value || boost::is_volatile< U >::value ? 1 : 4 : boost::is_integral< T_ >::value && boost::is_integral< U_ >::value ? boost::is_same< T_, char >::value || boost::is_same< U_, char >::value ? 1 : std::numeric_limits< T_ >::is_signed == std::numeric_limits< U_ >::is_signed ? sizeof( typename Z< T_, U_ >::isLeftType( true ? createT_() : createU_() ) ) == sizeof( YesType ) ? 2 : 3 : 1 : boost::is_float< T_ >::value && boost::is_float< U_ >::value ? sizeof( typename Z< T_, U_ >::isLeftType( true ? createT_() : createU_() ) ) == sizeof( YesType ) ? 2 : 3 : boost::is_pointer< T_ >::value && boost::is_pointer< U_ >::value ? boost::is_base_and_derived< typename boost::remove_pointer< T_ >::type, typename boost::remove_pointer< U_ >::type >::value ? 2 : boost::is_base_and_derived< typename boost::remove_pointer< U_ >::type, typename boost::remove_pointer< T_ >::type >::value ? 3 : 1 : 1 >, NoType, T_, U_, typename RemoveWarning64< typename UniteCvQualifiers< T, U >::type >::type >::type type; // <=============================== };da bekomme ich in der markierten zeile:
error C3203: 'arg' : class template invalid as template argument for template parameter 'F', expected a real typeist bestimmt was simples, aber irgendwie entgeht es mir, schiesslich ist arg< ... > eine klasse und kein template
irgendwelche ideen dazu sind willkommen. bestimmt kann man das ganze auch generell viel einfcher bauen, inspiriert ist das ganze von
http://erdani.org/publications/cuj-04-2001.html
allerdings wollte ich kein loki benutzen und auch einige unsichere kombinationen (z.B. unsigned und signed typen) ausschliessen.
-
Args, das sieht aber übersichtlich aus

typedef typename boost::mpl::apply_wrap4< boost::mpl::arg< ... >,//<-- NoType, T_, U_, RemoveWarning64< UniteCvQualifiers< T, U >::type >::type >::type type;Kann es sein, daß du das arg<...>::type vergessen hast?
-
das müsste so richtig sein:
http://www.boost.org/libs/mpl/doc/refmanual/arg.html
es funktioniert in RemoveWarning64 ja auchich versuch mich gerade etwas in mpl hereinzufinden, bestimmt geht das ganze auch eleganter.