To give a complete example, let\'s say I have a template class that I now use to
ID: 658936 • Letter: T
Question
To give a complete example, let's say I have a template class that I now use to generate a type definition:
template <typename T>
struct A {};
using X = // I'm not asking about this
A<int>; // I want to know what this is
What is the name of A<int>? My initial thoughts were that it was a generic specialisation of A, because I recall reading that somewhere in reference to the standard, but I can't find it now.
The answer should make reference to the standard or, if that is not possible, cite an authoritative source that sets some sort of precedent for how it is named.
I know these kinds of questions are borderline but I don't know of any other place to ask them and I've done my best to address the points raised in this meta discussion about questions on naming.
Explanation / Answer
It's just an alias: it takes A<T> , instantiate it with T=int and calls it X
Declare X a; and a will be an A<int>.
The documentation is as cppreference
Here are some references.
About A it is a "template instantiation": the generic type A is compiled using int in the place of T.
It is like vector<int> respect to vector<double> starting from vector<T>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.