Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

20.1 User-Defined Character Types

One of the fundamental differences between the new, templated iostreams and the traditional iostreams is the ability of the new iostreams to accommodate user-defined character types. It's now possible to use the C++ iostreams interface with arbitrary character-like types, as well as with ordinary chars.

Of course, this flexibility comes at a price. Any user-defined character type must satisfy rather severe requirements. The type really must act like an ordinary char in most circumstances. In addition, several classes must be defined to support the type in the iostreams environment.

20.1.1 Requirements for User-Defined Character Types

In general, user-defined character types must meet the following requirements:

In addition, it must be possible to convert an object of the user-defined type to an object of type char and vice versa. These particular conversions need not be part of the type itself. They are defined as part of the new character classification facet that must accompany the new type. We'll examine these conversions a little later on.

The following type satisfies the requirements for a user-defined type:


Previous fileTop of DocumentContentsIndexNext file

OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.