jeudi 1 octobre 2015

Does explicit template instantiation definition also suppress implicit instantiation?

I know that explicit instantiation declarations suppress following implicit instantiations. But what if there is only an explicit instantiation definition? Does it suppress following implicit instantiations also?

For example:

#include <vector>

template class std::vector<int>;  // Explicit template instantiation definition.

int main() {
    std::vector<int> a;  // Implicit instantiation.
}

Does the explicit template instantiation definition suppress the implicit instantiation that follows? I know that the implicit instantiation is suppressed if I make the explicit definition into a declaration by prepending the extern keyword.

Aucun commentaire:

Enregistrer un commentaire