beautypg.com

HP Integrity NonStop H-Series User Manual

Page 220

background image

matrix > long_matrix;

Of course you don't even have to specialize on matrix_traits. You just have to make sure you
provide the interface that matrix expects from its traits template parameter.

Most of the time, the operations contained in a traits class will be static functions so that there's
no need to actually instantiate a traits object.

The Standard Library uses this technique to give the

string

class maximum flexibility and

efficiency across a wide range of types. The string traits class provides elementary operations
on character arrays. In the simplest case, this means providing string a wstring with access to
the 'C' library functions for skinny and wide characters, for example Strcpy and wcstrcpy.

See the

string_char_traits

reference entry for a complete description of the traits class.

This manual is related to the following products: