IBM Support

How to use Template Class Specialization in Rational Rhapsody

Technote (FAQ)


Question

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

Cause

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

Answer

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.

Historical Number

10477

Document information

More support for: Rational Rhapsody
General Information

Software version: 7.2, 7.3, 7.4, 7.5, 7.6, 8.0, 8.1, 8.2

Operating system(s): Linux, Windows

Reference #: 1323750

Modified date: 04 June 2008