beautypg.com

HP Integrity NonStop J-Series User Manual

Page 140

background image

As mentioned above, some compilers will require that the expression (t1 < t2) be defined for
two instances of your element type. This is due to the inclusion of convenient member
functions, such as sort() and min_element(),combined with certain compilers that instantiate all
member functions whether used or not. You might have existing code that instantiates one of
these templates on a type T for which no operator<() is defined. If that is the case, you will have
to define one.

The best thing would be to define it in a way you can really use, if you ever use those member
functions which really do require it. The quick and dirty approach would be to globally define a
dummy operator<() whose only purpose is to appease the compiler. Our experience is that code
written "just to appease the compiler" constitutes a maintenance nightmare. Please avoid it if at
all possible.

This manual is related to the following products: