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

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    4

    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 (
    Code:
    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
    Code:
    C<TT>
    is constructed in this library as well. One method ( ex:
    Code:
    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:
    Code:
    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
    Code:
    C<T>::f()
    is called (which does nothing).
    If "b" is linked to "a" then explicitly specialized
    Code:
    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

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 01-30-2011, 04:28 PM
  2. template specialization
    By CodeMonkey in forum C++ Programming
    Replies: 3
    Last Post: 12-29-2008, 02:02 AM
  3. Replies: 6
    Last Post: 08-12-2007, 02:02 PM
  4. Partial specialization of class template.
    By CornedBee in forum C++ Programming
    Replies: 4
    Last Post: 11-20-2003, 09:24 AM
  5. Template specialization
    By Unregistered in forum C++ Programming
    Replies: 0
    Last Post: 06-19-2002, 08:08 AM

Tags for this Thread

Website Security Test