How to use Template Class Specialization in Rational Rhapsody
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
More support for:
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