Информация об изменениях

Сообщение Re[4]: variadic list неспециализированных шаблонов от 20.09.2014 22:38

Изменено 20.09.2014 22:46 niXman

та нет, что-то не так...

вот компилябельный пример(вдруг есть желание покопаться ):

template<template<typename, template<typename> class> class...>
struct t_invokers;
template<typename...>
struct t_services;

template<typename Invokers, typename Services>
struct type;

template<typename... Invokers, typename... Services>
struct type<t_invokers<Invokers...>, t_services<Services...>> {

};

/***************************************************************************/

template<typename UC, template<typename> class GC>
struct first_invoker {
    first_invoker(UC &uc, GC<UC> &gc)
    {}
};

template<typename UC, template<typename> class GC>
struct second_invoker {
    second_invoker(UC &uc, GC<UC> &gc)
    {}
};

struct ping_service {};
struct statistic_service {};

/***************************************************************************/

int main() {
    using _t_invokers = t_invokers<first_invoker, second_invoker>;
    using _t_services = t_services<ping_service, statistic_service>;
    type<_t_invokers, _t_services> t;
}

/***************************************************************************/


вот что говорит:
variadic.cpp:11:35: error: type/value mismatch at argument 1 in template parameter list for 'template<template<class, template<class> class<template-parameter-2-2> > class ...<template-parameter-1-1> > struct t_invokers'
 struct type<t_invokers<Invokers...>, t_services<Services...>> {
                                   ^
variadic.cpp:11:35: error:   expected a class template, got 'Invokers ...'
variadic.cpp:11:60: error: template argument 1 is invalid
 struct type<t_invokers<Invokers...>, t_services<Services...>> {
                                                            ^
variadic.cpp: In function 'int main()':
variadic.cpp:37:33: error: aggregate 'type<t_invokers<first_invoker, second_invoker>, t_services<ping_service, statistic_service> > t' has incomplete type and cannot be defined
  type<_t_invokers, _t_services> t;
                                 ^
Re[4]: variadic list неспециализированных шаблонов
та нет, что-то не так...

вот компилябельный(сильно упрощенный и не раскрывающий идеи) код(вдруг есть желание покопаться ):

template<template<typename, template<typename> class> class...>
struct t_invokers;
template<typename...>
struct t_services;

template<typename Invokers, typename Services>
struct type;

template<typename... Invokers, typename... Services>
struct type<t_invokers<Invokers...>, t_services<Services...>> {

};

/***************************************************************************/

template<typename UC, template<typename> class GC>
struct first_invoker {
    first_invoker(UC &uc, GC<UC> &gc)
    {}
};

template<typename UC, template<typename> class GC>
struct second_invoker {
    second_invoker(UC &uc, GC<UC> &gc)
    {}
};

struct ping_service {};
struct statistic_service {};

/***************************************************************************/

int main() {
    using _t_invokers = t_invokers<first_invoker, second_invoker>;
    using _t_services = t_services<ping_service, statistic_service>;
    type<_t_invokers, _t_services> t;
}

/***************************************************************************/


вот что говорит:
variadic.cpp:11:35: error: type/value mismatch at argument 1 in template parameter list for 'template<template<class, template<class> class<template-parameter-2-2> > class ...<template-parameter-1-1> > struct t_invokers'
 struct type<t_invokers<Invokers...>, t_services<Services...>> {
                                   ^
variadic.cpp:11:35: error:   expected a class template, got 'Invokers ...'
variadic.cpp:11:60: error: template argument 1 is invalid
 struct type<t_invokers<Invokers...>, t_services<Services...>> {
                                                            ^
variadic.cpp: In function 'int main()':
variadic.cpp:37:33: error: aggregate 'type<t_invokers<first_invoker, second_invoker>, t_services<ping_service, statistic_service> > t' has incomplete type and cannot be defined
  type<_t_invokers, _t_services> t;
                                 ^