Imagine a library has class templates A and B:
template <template <class> class T> class A;
template <class T, class U> class B;
Now, if a user of the library wants to pass B as an argument of A, he/she can do:
template <class T>
using C = B<T, UserType>;
A<C> a{};
However, B might actually have much more template and template template arguments, which would make this extremely ugly on the user side: every time a user would want to use A with different type, he/she would have to do that huuuge type aliasing and then use a different name for each different type. That is obviously not an option.
Is it thus possible for the implementers of such library to allow a user to do:
A<D<UserType>> a{};
where D would be "deduced" to be template <class T> B<T, UserType>.
Conceptually, the implementers should do:
template <class UserType>
using D = template <class T> B<T, UserType>;
and then D could be passed as a template argument to A as A<D<UserType>>. However, as mentioned here, this does not compile.
Is there a way for the implementers to allow users to do both A<C> and A<[B, UserType]>, where brackets denote some operation with B and UserType that is implemented on the library side? Obviously, the implementers could use different names such as A1 and A2 but they do not want to since A1 and A2 would do the same thing and work in the same way.
You're describing something like
D<UserType>as something that is a template itself, whereD<UserType><T>(imaginary syntax) isB<T, UserType>.This is not possible, but you can get close by having a member template,
D<UserType>::member<T>