The GNU C++ Iostream Library - Extending

Node: Extending Next: Synchronization Prev: Manipulators Up: Ios

Extended data fields

A related collection of methods allows you to extend this collection of flags and parameters for your own applications, without risk of conflict between them:

Method static fmtflags ios::bitalloc ()
Reserve a bit (the single bit on in the result) to use as a flag. Using bitalloc guards against conflict between two packages that use ios objects for different purposes.

This method is available for upward compatibility, but is not in the ansi working paper. The number of bits available is limited; a return value of 0 means no bit is available.

Method static int ios::xalloc ()
Reserve space for a long integer or pointer parameter. The result is a unique nonnegative integer. You can use it as an index to ios::iword or ios::pword . Use xalloc to arrange for arbitrary special-purpose data in your ios objects, without risk of conflict between packages designed for different purposes.

Method long& ios::iword (int index)
Return a reference to arbitrary data, of long integer type, stored in an ios instance. index, conventionally returned from ios::xalloc , identifies what particular data you need.

Method long ios::iword (int index) const
Return the actual value of a long integer stored in an ios .

Method void*& ios::pword (int index)
Return a reference to an arbitrary pointer, stored in an ios instance. index, originally returned from ios::xalloc , identifies what particular pointer you need.

Method void* ios::pword (int index) const
Return the actual value of a pointer stored in an ios .


Next: Synchronization Up: Ios