S
Stephen Horne
Can the same template with the same parameters be both forcibly
instantiated and extern-templated in the same compilation unit? If so,
which takes precedence.
For example, it might make sense to have a header which declares a
template and then uses extern template for all the common
instantiations, and an implementation file for the library that
#includes that header then overrides all those extern template lines
to force the instantiation of those templates. The idea is to localise
the instantiation of these common cases to the library, preventing
users of that library from re-doing that work.
instantiated and extern-templated in the same compilation unit? If so,
which takes precedence.
For example, it might make sense to have a header which declares a
template and then uses extern template for all the common
instantiations, and an implementation file for the library that
#includes that header then overrides all those extern template lines
to force the instantiation of those templates. The idea is to localise
the instantiation of these common cases to the library, preventing
users of that library from re-doing that work.