variadic templates auf normale template-Klasse expandieren



  • hallihallo

    ist der folgende c++0x code valid?

    template<class A=char,class B=char,class C=char> class bar
    {
    };
    
    template<class... bub> class foo
    {
    	typedef bar<bub...> dab;
    };
    
    typedef foo<> a1;
    typedef foo<int> a2;
    typedef foo<int,int> a3;
    typedef foo<int,int,int> a4;
    

    In meinen Augen schon (zumindest fühlt sich der Code intuitiv richtig an), aber gcc 4.3 meckert!

    error: cannot expand 'bub ...' into a fixed-length argument list

    Was wäre ein guter workaround (das eigentlich Problem ist etwas komplexer - ich möchte meine variadic template arguments in einen boost::mpl::vector packen und dann damit ein wenig arbeiten. Leider funktioniert mpl::vector<Args...> nicht - gleicher fehler 😞 )


Anmelden zum Antworten