Ответ 1
Я предполагаю, что это ошибка в gcc, поэтому я сделал обходной путь на данный момент
// partially specializes a template
template<template<class, class>class TT, class T>
struct TemplateBind{
template<class S>
using type = TT<T, S>;
};
// the workaround
template<template<template<class>class...>class A,
template<class, class>class B,
template<class>class... C>
class workaround {
template<class D, class... E>
static auto get_type(D, E...)
-> typename workaround<A, B, C..., TemplateBind<B, D>::template type>::template type<E...>;
static auto get_type()
->A<C...>;
public:
template<class... T>
using type = decltype(get_type(std::declval<T>()...));
};
// convinience alias
template<template<template<class>class...>class OriginalTemplate,
template<class, class>class Substitution,
class... Types>
using InstatiateVariadicTemplateTemplate = typename workaround<OriginalTemplate, Substitution>::template type<Types...>;
Затем мы можем определить оболочку для define_template
// wrapper alias gets define_template in the right form
template<class A, class B>
using my_wrapper = typename define_template<A>::template type<B>;
и выполните следующие действия
template<class... T>
using my_alias = InstatiateVariadicTemplateTemplate<my_class, my_wrapper, T...>;