If you have a template struct then you can use T as the type of a value parameter of a member template:
template <typename T>
struct SMoo
{
template <T I, typename T2>
struct SBaa {};
};
SMoo<int>::SBaa<3, bool> moobaa;
You can do the same with a variadic outer template:
template <typename ... VT>
struct SMoo
{
template <VT ... VI, typename T2>
struct SBaa {};
};
SMoo<int, bool>::SBaa<3, true, bool> moobaa;
You can also use T as the type of a value parameter of a template-template parameter of a member template:
template <typename T>
struct SMoo
{
template <template <T I, typename T2> typename TT>
struct SBaa {};
};
template <int I, typename T>
struct SCaw {};
SMoo<int>::SBaa<SCaw> moobaacaw;
You can combine these to get:
template <typename ... VT>
struct SMoo
{
template <template <VT ... VI, typename T2> typename TT>
struct SBaa {};
};
template <int I, typename T>
struct SCaw {};
SMoo<int>::SBaa<SCaw> moobaacaw;
But this seems to fail as soon as there's more than one VT parameter:
template <typename ... VT>
struct SMoo
{
template <template <VT ... VI, typename T2> typename TT>
struct SBaa {};
};
template <int I, typename VT>
struct SCaw {};
template <int I, bool B, typename VT>
struct SMew {};
SMoo<int>::SBaa<SCaw> moobaacaw;
//SMoo<int, bool>::SBaa<SMew> moobaamew; // <<=== FAILS HERE (WHY?)
SMoo<int, bool>::SBaa<SCaw> moobaacaw2; // <<=== ALSO, DOESN'T FAIL HERE (WHY?)
the error is:
<FILE>:5:27: error: type/value mismatch at argument 1 in template parameter list for ‘template<class ... VT> template<template<template<VT ...VI, class T2> class TT> template<class ... VT> template<VT ...VI, class T2> class TT> struct SMoo<VT>::SBaa’
15 | SMoo<int, bool>::SBaa<SMew> moobaamew; // <<=== FAILS HERE (WHY?)
| ^
<FILE>:15:27: note: expected a template of type ‘template<class ... VT> template<VT ...VI, class T2> class TT’, got ‘template<int I, bool B, class VT> struct SMew’
It's like the VT parameter isn't being matched accurately.
Can this be fixed?