explicit specialization of methods of a template class in several .so

Hi All,
I need a confirmation that what I do is perfectly correct and I need to learn documents that confirm that.
I have a template class (template <class T> class C) which is defined in the shared library "a". Some of the methods of the class C are specialized/defined explicitly for some particular type TT in the same shared library "a" and an object of C<TT> is constructed in this library as well. One method ( ex: void C::f() ) is not specialized explicitly for type TT in library "a" but specialized in another shared library "b". Just in case: C<T>::f() has some compilable definition for any type T, ex: template<class T> void C<T>::f(){} in library "a".
Library "b" is not always linked to "a". If it's not linked the default C<T>::f() is called (which does nothing).
If "b" is linked to "a" then explicitly specialized C<TT>::f() which resides in "b" is called. This is what I expect.
Is it standard behavior? Is it documented somewhere? Where?
I'm using gcc under linux and the code is compiled for FreeBSD.

Thanks,
Boris
Unless I'm missing something I think your explanation is correct and predictable.
Thanks moorecm. It looks like a natural behavior to me however I need some document to prove that to someone else. Is it somewhere in C++ standard or g++ documentation? I could not find that.
I got the answer at codeguru forum:
C++0x-draft-n3092, 14.7.3.6
If a template, a member template or the member of a class template is explicitly specialized then that
specialization shall be declared before the first use of that specialization that would cause an implicit instantiation to take place, in every translation unit in which such a use occurs; no diagnostic is required. If the program does not provide a definition for an explicit specialization and either the specialization is used in a way that would cause an implicit instantiation to take place or the member is a virtual member function, the program is ill-formed, no diagnostic required. An implicit instantiation is never generated for an explicit specialization that is declared but not defined.
Topic archived. No new replies allowed.