TooN Algorithm Library - tag  0.2
Variables
stream simplifications
Collaboration diagram for stream simplifications:

Variables

static struct Internal::add_fill_s tag::add_fill
 
static struct
Internal::like_print_s 
tag::print
 
static struct Internal::no_space_s tag::no_space
 

Detailed Description

This group contains two sets of enhancements for using the output streams in the standard library.

The first is a set of additional modifiers for use with the standard << operator. See add_fill , no_space and print for more details.

The second set introduces a new syntax using the comma operator for streams. It creates simple statements similar to print in Python or other languages. The stream object and any values to be printed are written as a comma separated list. Between the values printed, the stream's fill character is output to delimit values. Some examples:

cout, 12, \"hello\", 13, endl;
cout, setfill('|');
cout, 12, 13, 14, endl;

will result in the following output

12 hello 13
12|13|14

endl is treated specially and no separator is produced before or after it. Other iomanips are not treated specially and produce a fill character before their position (if they are not the first in the list).

Variable Documentation

struct Internal::add_fill_s tag::add_fill
static

Ostream modifier which puts spaces between elements using the fill character. endl is treated specially, so a space is not put after an endl

cout << add_fill << 1 << 2 << 3 << endl << 4<< 5 << endl;

This will print:

1 2 3
5 4
struct Internal::no_space_s tag::no_space
static

An ostream modifier to use with print and add_fill which prevents a space being added before the next element.

cout << @ref add_fill << 0 << 1 << no_space << 2 << 3 << endl;

will print:

0 12 3
struct Internal::like_print_s tag::print
static

Ostream modifier similar to add_fill, except that an endl is added at the end automatically

cout << print << 1 << 2 << 3;
cout << "hello" << endl;

Will print:

1 2 3
hello

Referenced by tag::vfPrintf().