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

This is a discussion on explicit specialization of methods of a template class in several .so within the Linux Programming forums, part of the Platform Specific Boards category; Hi All, I need a confirmation that what I do is perfectly correct and I need to learn documents that ...

  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
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789

Popular pages Recent additions subscribe to a feed

Similar Threads

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

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21