Rogue Wave banner
Top of DocumentContents

Endnotes

1
This example assumes that you have created a class, moneytype, to represent monetary values, and that you have written iostreams insertion << and extraction >> operators for the class. Further, it assumes that these operators format and parse values using the money_put and money_get facets of the locales imbued on the streams they're operating on. See Chapter 5 for a complete example of this technique, using phone numbers rather than monetary values. The moneytype class is not part of the Standard C++ Library.

Return
1
The shift operators for the character types, like char and wchar_t, are an exception to this rule; they are global functions in the standard library namespace ::std.

Return
2
Iostreams does not prevent you from setting other invalid combinations of these flags, however.

Return
3
The standard does not specify whether the grouping information, that is contained in a stream's locale's numpunct facet, is ignored or taken into account if present. In any case, there are no manipulators that allow to switch on and off the grouping.

Return
4
The classification of a character as a white space character depends on the character set used. The extractor takes the information from the locale's ctype facet.

Return
5
The stream buffer can be created as the stream's responsibility, or the buffer can be provided from outside the stream, so inadvertently the buffer could have 0 size.

Return
6
The streams layer catches bad_alloc exceptions thrown during allocation of its internal resources, iword and pword. It would then set badbit or failbit. An exception would be thrown only if the respective bit in the exception mask asks for it. The exception is ios_failure.

Return
7
Note that each change of either the stream state or the exception mask can result in an exception thrown. This is because the functions setstate() and exception() raise an exception in case the exception mask requires it.

Return
8
See Bjarne Stroustrup, The C++ Programming Language, 3rd Edition, p.366.

Return
9
The traditional iostreams supported a constructor, taking a file descriptor, that allowed connection of a file stream to an already open file. This is not available in the standard iostreams. However, Rogue Wave's implementation of the standard iostreams provides a corresponding extension (see the Class Reference for file streams.).

Return
10
For output file streams the open mode out is equivalent to out|trunc, that is, you can omit the trunc flag. For bidirectional file streams, however, trunc must always be explicitly specified.

Return
11
Basically the binary mode flag is passed on to the respective operating system's service function, which means that in principle all system-specific conversions are suppressed, not only the carriage return / linefeed handling.

Return
12
This was different in the old iostreams, where you could have dynamic and static output streams. See Section 24.4 for further details.

Return
13
An alternative could be to provide Manip as a static or a global object at the user's convenience. Unfortunately, this approach would introduce the well-known order-of-initialization problems for global and static objects.

Return
14
Traditional iostreams had classes called ostream_withassign that explicitly allowed copying and assignment of stream objects.

Return
15
This feature was available in the traditional iostreams, but is not offered by the standard iostreams. Rogue Wave's implementation of the standard iostreams retains the old feature for backward compatibility with the traditional iostreams, but it is a nonstandard feature. Using it might make your application non-portable to other standard iostream libraries.

Return
16
The traditional iostreams' strstream allows you to obtain a pointer to the stream's internal buffer. Different from the standard iostreams' stringstream, it does not create a copy of the internal data. Hence, using the deprecated strstream instead of the standard stringstream spares you the overhead of creating a second copy of the data.

Return
17
In the case of input streams, the behavior of sync() is implementation-defined, that is, not standardized. The traditional iostreams had a sync() function that did the expected synchronization, that is, refilling the buffer beginning with the current file position.

Return
18
See functions strftime(), strptime(), and wcsftime() in X/Open for reference.

Return
19
According to the standard, they are two separate arrays. However, the Rogue Wave implementation uses the old technique involving only one array, since that part of the document is suggested only.

Return
20
For brevity, error handling is omitted in the example. If allocation fails, then badbit is set.

Return
21
This, of course, is only an example. You would probably never derive a new class for adding only one data member. However, it keeps the example simple and allows us to demonstrate the principle of deriving new stream classes.

Return
22
For a more detailed discussion of the problem and its solution, see Section 14.2, p. 306ff, of Bjarne Stroustrup, "The Design and Evolution of C++," Addison-Wesley 1994.

Return
23
In our example of a conversion between ASCII and EBCDIC, we have no reason to ever return partial, because this is a conversion of single byte characters. Either a character can be recognized and converted, or the conversion fails; that is, error is returned. The partial return code only makes sense in wide-character and multibyte conversions.

Return

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