]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/doc/reference/adaptors/formatted.qbk
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / doc / reference / adaptors / formatted.qbk
1 [/
2 Copyright 2014 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 /]
6 [section:formatted formatted]
7
8 [table
9 [[Syntax] [Code]]
10 [[Pipe] [`rng | boost::adaptors::formatted()`]]
11 [[Pipe] [`rng | boost::adaptors::formatted(sep)`]]
12 [[Pipe] [`rng | boost::adaptors::formatted(sep, prefix)`]]
13 [[Pipe] [`rng | boost::adaptors::formatted(sep, prefix, postfix)`]]
14 [[Function] [`boost::adaptors::format(rng)`]]
15 [[Function] [`boost::adaptors::format(rng, sep)`]]
16 [[Function] [`boost::adaptors::format(rng, sep, prefix)`]]
17 [[Function] [`boost::adaptors::format(rng, sep, prefix, postfix)`]]
18 ]
19
20 This adaptor produces a range that can be output streamed to a
21 `std::basic_ostream` to produce the output string formatted output. With the
22 default paramters given numbers 1 to 5 inclusively in a range the output when
23 streamed would be "{0,1,2,3,4,5}". The prefix, separator and postfix may be
24 passed as parameters.
25
26 The general format of the output is thus:
27 <prefix><element_1><sep><element_2><sep>...<element_n><postfix>
28
29 * [*Precondition:]
30 * `0 <= n`.
31 * `sep` has a type that is CopyConstructible and able to be streamed to `std::basic_ostream<Char,Traits>`
32 * `prefix` has a type that is CopyConstructible and able to be streamed to `std::basic_ostream<Char,Traits>`
33 * `postfix` has a type that is CopyConstructible and able to be streamed to `std::basic_ostream<Char,Traits>`
34 * [*Returns:] `boost::range::formatted_range<Iter, Sep, Prefix, Postfix>` where
35 `Iter` is `typename boost::range_iterator<Rng>::type`, `Sep` is the separator
36 type, `Prefix` is the prefix type and `Postfix` is the postfix type.
37 * [*Range Category:] __single_pass_range__
38 * [*Returned Range Category:] The range category of `rng`.
39
40 [section:formatted_example formatted example]
41 [import ../../../test/adaptor_test/formatted_example.cpp]
42 [separated_example]
43 [endsect]
44
45 This would produce the output:
46 ``
47 {1,2,3,4,5}
48 ``
49 [endsect]
50
51