Partial specializations of alias templates are not permitted:
For example, trying to be creative, yields this error in clang:
template <typename T>
using unwrapped_future_t = T;
template <typename T>
using unwrapped_future_t<future<T>> = typename future<T>::value_type;
^~~~~~~~~~~
> error: partial specialization of alias templates is not permitted
Why is this not permitted?
You can find the answer in the original proposal of alias templates:
2.2 The Main Choice: Specialization vs. Everything Else
After discussion on the reflectors and in the Evolution WG, it turns out that we have to choose between two mutually exclusive models:
A typedef template is not itself an alias; only the (possibly-specialized) instantiations of the typedef template are aliases. This choice allows us to have specialization of typedef templates.
A typedef template is itself an alias; it cannot be specialized. This choice would allow:
- deduction on typedef template function parameters (see 2.4)
- a declaration expressed using typedef templates be the same as the declaration without typedef templates (see 2.5)
- typedef templates to match template template parameters (see 2.6)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With