Сообщение Re[4]: variadic list неспециализированных шаблонов от 20.09.2014 22:38
Изменено 20.09.2014 22:41 niXman
та нет, что-то не так...
вот компилябельный пример(вдруг есть желание покопаться ):
вот что говорит:
вот компилябельный пример(вдруг есть желание покопаться ):
template<template<typename, typename> 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: invoker_base {
first_invoker(UC &uc, GC<UC> &gc)
{}
};
template<typename UC, template<typename> class GC>
struct second_invoker: invoker_base {
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, class> 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:18:36: error: expected class-name before '{' token
struct first_invoker: invoker_base {
^
variadic.cpp:24:37: error: expected class-name before '{' token
struct second_invoker: invoker_base {
^
variadic.cpp: In function 'int main()':
variadic.cpp:35:62: error: type/value mismatch at argument 1 in template parameter list for 'template<template<class, class> class ...<template-parameter-1-1> > struct t_invokers'
using _t_invokers = t_invokers<first_invoker, second_invoker>;
^
variadic.cpp:35:62: error: expected a template of type 'template<class, class> class ...<template-parameter-1-1>', got 'template<class UC, template<class> class GC> struct first_invoker'
variadic.cpp:35:62: error: type/value mismatch at argument 1 in template parameter list for 'template<template<class, class> class ...<template-parameter-1-1> > struct t_invokers'
variadic.cpp:35:62: error: expected a template of type 'template<class, class> class ...<template-parameter-1-1>', got 'template<class UC, template<class> class GC> struct second_invoker'
variadic.cpp:37:7: error: '_t_invokers' was not declared in this scope
type<_t_invokers, _t_services> t;
^
variadic.cpp:37:31: error: template argument 1 is invalid
type<_t_invokers, _t_services> t;
^
variadic.cpp:37:34: error: invalid type in declaration before ';' token
type<_t_invokers, _t_services> t;
^
та нет, что-то не так...
вот компилябельный пример(вдруг есть желание покопаться ):
вот что говорит:
вот компилябельный пример(вдруг есть желание покопаться ):
template<template<typename, typename> 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, class> 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:35:62: error: type/value mismatch at argument 1 in template parameter list for 'template<template<class, class> class ...<template-parameter-1-1> > struct t_invokers'
using _t_invokers = t_invokers<first_invoker, second_invoker>;
^
variadic.cpp:35:62: error: expected a template of type 'template<class, class> class ...<template-parameter-1-1>', got 'template<class UC, template<class> class GC> struct first_invoker'
variadic.cpp:35:62: error: type/value mismatch at argument 1 in template parameter list for 'template<template<class, class> class ...<template-parameter-1-1> > struct t_invokers'
variadic.cpp:35:62: error: expected a template of type 'template<class, class> class ...<template-parameter-1-1>', got 'template<class UC, template<class> class GC> struct second_invoker'
variadic.cpp:37:7: error: '_t_invokers' was not declared in this scope
type<_t_invokers, _t_services> t;
^
variadic.cpp:37:31: error: template argument 1 is invalid
type<_t_invokers, _t_services> t;
^
variadic.cpp:37:34: error: invalid type in declaration before ';' token
type<_t_invokers, _t_services> t;
^