Not a Boost library.
Format Lite is a lightweight, easy-to-learn framework for formatting data structures such as standard library containers and Boost tuples. It provides a reasonable degree of customizability with an emphasis on human-readable output formats useful for testing and debugging.
A future version of Format Lite could be a candidate for incorporation into C++0x, to compensate for the lack of standard iostreams inserters and extractors for standard library containers, and to make existing inserters and extractors — such as those provided in <complex> — more flexible.
Format lite provides three function templates:
boost::io::punctuate, used to specify punctuation sequences and options for line-breaks and indentation.
operator<<, used to insert ranges and tuple-like objects into standard output streams.
operator>>, used to extract ranges and tuple-like objects from standard input streams.[1]
<boost/iostreams/format_lite.hpp>
The implementation of Format Lite uses class template partial specialization, template template parameters and SFINAE. It is therefore supported only by reasonably conformant compilers.
Format Lite contains nine regression tests and a Jamfile in the directory <libs/format_lite/test>. The tests have been run on the following platforms:
| Platform | Passed |
| Microsoft Visual C++ 7.1 | 100% |
| GCC 3.2 (MinGW) | 100% |
| Intel 8.0 for Windows | 100% |
[1]The latter two function templates are defined in namespace std. This results in undefined behavior according to 17.4.3.1 of the C++ standard, but helps to keep the library simple and easy to learn and is essential if Format Lite is to serve as the basis for a standard library proposal. While the behavior is strictly-speaking undefined, in practice these operators behave as intended.
One way to avoid introducing declarations into namespace std would be to add a fourth user-level function boost::io::format and to replace invocations of the form out << x and in >> x with out << boost::io::format(x) and in >> boost::io::format(x). This is the approach taken by Reece Dunne's recently reviewed Output Formatters library.
Revised 20 May, 2004
© Copyright Jonathan Turkanis, 2004
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Sha'arei Tefila, an Orthodox Shul (Synagogue) in Salt Lake City, Utah Chabad Lubavitch of Utah