I was reading a application source and I've faced with thing like this:
class A
{
};
template<>
class B<A>
{
};
the problem is that I can't understand class B<A>
meaning.
What does this mean?
I was reading a application source and I've faced with thing like this:
class A
{
};
template<>
class B<A>
{
};
the problem is that I can't understand class B<A>
meaning.
What does this mean?
This means that class B
has been declared as a template, and now you have a template specialization. Just like in sewing, this means that B
won't work on its own, but requires another class, here A
, to work.
It is a new type and then B
will use A
as kind of thread (to continue the sewing analogy) wherever the original type (that you didn't show) was.
You may want to have a look at https://en.cppreference.com/w/cpp/language/templates