How often do C++ developers write specialized templates?

 

Just to make sure that I don’t mislead you on the terminology, here is an example…

 

      // Primary List template

      // initialCount is the default parameter

      template <typename T, int intialCount = 0>

      class List {};

 

      // List template is specialized for "int"

      template <>

      class List<int> {};

 

You know that in a C++ Class Designer user can right click on a member (field or property) and do “Show as Association”. Also the user can right click on a type on the diagram and do “Show Base”. Moreover the user can drag drop any type from Class View on to the diagram. In all such cases we have to go and fetch the right type.

 

We are finding it very difficult to resolve template specializations to the right type, especially when they employ default parameters. So I would like you to give me your opinion on how often C++ developers write code that specializes templates. And when they use libraries that employ template specializations (STL does) how often would they like to browse to those types in that library.

 

What would you prefer in case we can’t resolve to the correct type?

Some of the choices are

  1. Not support template specializations at all. Note that STL employs a lot of template specialization.
  2. Try to resolve and if we can’t (especially when there are default parameters) then put an error message. Again STL uses a lot of default template parametersJ.
  3. Try to resolve and if we can’t resolve then always fetch the primary template. But it could be the wrong one.