In C++03, you couldn't template aliases, but since C++11 it's allowed with the using
syntax.
For example, the following (using typedef
) is invalid:
template<class T>
typedef vector<T> v;
Whereas the following (using using
) is fine:
template<class T>
using v = vector<T>;
My question is not related to the rationale of The Committee for only supporting templated aliases with using
.
My question is, is there any technical reason that this couldn't be supported? Basically, were the committee to allow this with typedef
, would there be any implementation problems? For example, would it conflict with something else or cause some weird parsing issue?
For any cases I've been able to come up with, it should be fine, but I'm no expert which is why I'm asking here.
Research I've done, that doesn't answer the question:
- Why do type aliases in C++ use 'using' instead of 'typedef' in their syntax? discusses the Committee's rationale, but not any technical reasons.
- C++ template typedef discusses not being able to use templated
typedef
, not any technical reasoning behind it.
Aucun commentaire:
Enregistrer un commentaire