IBM Support

How to use Template Class Specialization in Rational Rhapsody

Question & Answer


How do you use Template Class Specialization in IBM Rational Rhapsody?


Support for Template Class Specialization is supported in Rational Rhapsody release 7.1 and higher.


To use Template Class Specialization you can do the following:

  1. Create a class template with parameter Class T.  
    For example myTemplate

  2. Create a second class template.
    Leave the name as default for now, For Example class_1.
    You cannot rename it to myTemplate at this stage without Rhapsody displaying a "duplicate name" error.

  3. Open the features windows of the class_1 template.

  4. Select your myTemplate<T> template in the drop down list in the lower window of the parameters tab.
    Note that Rhapsody has now changed the class_1 template name to "myTemplate".

  5. Select the template parameter "T" in the features window of the specialization, (in the upper panel) and remove it. 

  6. Enter a specialized value in the lower value field to specialize the template. Hit apply. 
    The specialized template will appear in the same source file as your original template.

You can now add specialized methods and attributes for the myTemplate template specialization by:
  1. Right clicking the template class
  2. Selecting Add.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"7.2;7.3;7.4;7.5;7.6;8.0;8.1;8.2","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number


Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022