mercredi 29 juillet 2020

Technical reasons that C++11 can't support templated typedefs

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:

Aucun commentaire:

Enregistrer un commentaire