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:
- Create a class template with parameter Class T.
- Create a second class template.
Leave the name as default for now, For Example
You cannot rename it to
myTemplate at this stage without Rhapsody displaying a "
duplicate name" error.
- Open the features windows of the
- 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 "
- Select the template parameter "T" in the features window of the specialization, (in the upper panel) and remove it.
- 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:
- Right clicking the template class
16 June 2018