Why are there no typedef patterns in C ++ 11?

Why did the Committee decide not to approve the templates typedefwith the template using?

template <class T>
using my_vector = std::vector<T>;

is legal.

But

template <class T>
typedef std::vector<T> my_vector<T>;

is illegal?

Upd. Question Why C ++ 11 does not have a typedef pattern? NOT responding.

+4
source share
1 answer

Quote from the proposal Alias ​​Templates for C ++ N1489 ( Emphasis Mine ):

It was suggested (repeatedly) to use the keywordtypedef - as done in article [4] - to introduce template aliases:

template<class T>
typedef std::vector<T, MyAllocator<T> > Vec;

, , . , , , , ; Vec typedef -name. Vec std::vector<., MyAllocator<.>> - . , "typedef" .

[4] Herb Sutter, Typedef, β„– . WG21/1406. >

+9

Source: https://habr.com/ru/post/1671336/


All Articles