| Home | Libraries | People | FAQ | More

# Boost Format library

The format library provides a class for formatting arguments according to a format-string, as does printf, but with two major differences :

- format sends the arguments to an internal stream, and so is entirely type-safe and naturally supports all user-defined types.
- The ellipsis (...) can not be used correctly in the strongly typed context of format, and thus the function call with arbitrary arguments is replaced by successive calls to an argument feeding operator%

You can find more Details in :

- Documentation (HTML).
- Headers
  - format.hpp : user frontend.
  - format_fwd.hpp : user forward declarations.
  - format_class.hpp : the class interface
  - format_implementation.hpp: implementation of the member functions
  - feed_args.hpp : argument feeding helper functions
  - free_funcs.hpp : free functions definitions
  - parsing.hpp : code for parsing format-strings
  - group.hpp : auxiliary struct used to group arguments and manipulators
  - exceptions.hpp : exceptions used by the library
  - internals.hpp : auxiliary structs stream_format_state and format_item
- Sample programs
  - The program sample_formats.cpp demonstrates simple uses of format.
  - sample_new_features.cpp illustrates the few formatting features that were added to printf's syntax such as simple positional directives, centered alignment, and 'tabulations'.
  - sample_advanced.cpp demonstrates uses of advanced features, like reusing, and modifying, format objects, etc..
  - And sample_userType.cpp shows the behaviour of the format library on user-defined types.

Submitted by Samuel Krempp.