[27] Thanks to Reg Charney of the C++ Standards Committee for suggesting this trick.
[28] Some of the material in this chapter was originally created by Nancy Nicolaisen.
[29] It’s difficult to make reference-counting implementations thread safe. (See Herb Sutter,
[30] It as an abbreviation for "no position."
[31] Discussed in depth in Chapter 6.
[32] To keep the exposition simple, this version does not handle nested tags, such as comments.
[33] It is tempting to use mathematics here to factor out some of these calls to erase( ), but since in some cases one of the operands is string::npos (the largest unsigned integer available), integer overflow occurs and wrecks the algorithm.
[34] Alert: For the safety reasons mentioned, the C++ Standards Committee is considering a proposal to redefine string::operator[] to behave identically to string::at() for C++0x.
[35] Your implementation can define all three template arguments here. Because the last two template parameters have default arguments, such a declaration is equivalent to what we show here.
[36] Beware that some versions of Microsoft Word erroneously replace single quote characters with an extended ASCII character when you save a document as text, which of course causes a compile error. We have no idea why this happens. Just replace the character manually with an apostrophe.
[37] POSIX, an IEEE standard, stands for "Portable Operating System Interface" and is a generalization of many of the low-level system calls found in UNIX systems.
[38] The implementation and test files for FULLWRAP are available in the freely distributed source code for this book. See the preface for details.
[39] Explained in depth in Chapter 5.
[40] For this reason, we can write ios::failbit instead of ios_base::failbit to save typing.
[41] It is customary to use operator void*( ) in preference to operator bool( ) because the implicit conversions from bool to int may cause surprises, should you errantly place a stream in a context where an integer conversion can be applied. The operator void*( ) function will only implicitly be called in the body of a Boolean expression.
[42] An integral type used to hold single-bit flags.
[43] A more in-depth treatment of stream buffers and streams in general can be found in Langer & Kreft’s,
[44] For more information on machine epsilon and floating-point computation in general, see Chuck’s article, "The Standard C Library, Part 3",
[45] Before putting nl into a header file, make it an inline function (see Chapter 7).
[46] Jerry Schwarz is the designer of iostreams.
[47] See the Langer & Kreft book mentioned earlier for more detailed information.
[48] See, for example, Dinkumware’s Abridged library at www.dinkumware.com. This library omits locale support. and exception support is optional.
[49] Vandevoorde and Josuttis,
[50] The C++ standards committee is considering relaxing the only-within-a-template rule for these disambiguation hints, and some compilers are allowing then in non-template code already.
[51] See Stroustrup,
[52] Technically, comparing two pointers not inside the same array is undefined behavior, but compilers nowadays don’t complain about this. All the more reason to do it right.
[53] We are indebted to Nathan Myers for this example.
[54] Such as type information encoded in a decorated name.
[55] C++ compilers can introduce names anywhere they want, however. Fortunately, most don’t declare names they don’t need.
[56] If you’re interested in seeing the proposal, it’s Core Issue 352.
[57] A reference to the British animated short feature
[58] We discuss vector
[59] Since the forwarding functions are inline, no code is generated at all!
[60] Also called
[61] In a talk given at
[62] Another template idiom, mixin inheritance, is covered in Chapter 9.