]> Dogcows Code - chaz/yoink/blob - src/stlplus/strings/print_sequence.tpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / strings / print_sequence.tpp
1 ////////////////////////////////////////////////////////////////////////////////
2
3 // Author: Andy Rushton
4 // Copyright: (c) Southampton University 1999-2004
5 // (c) Andy Rushton 2004-2009
6 // License: BSD License, see ../docs/license.html
7
8 ////////////////////////////////////////////////////////////////////////////////
9 #include "print_pair.hpp"
10
11 namespace stlplus
12 {
13
14 ////////////////////////////////////////////////////////////////////////////////
15 // any forward iterator sequence
16
17 template <typename I, typename S>
18 void print_sequence(std::ostream& device,
19 I begin, I end,
20 S print_fn,
21 const std::string& separator)
22 {
23 for (I i = begin; i != end; i++)
24 {
25 if (i != begin) device << separator;
26 print_fn(device, *i);
27 }
28 }
29
30 ////////////////////////////////////////////////////////////////////////////////
31 // any sequence where the value is a pair
32
33 template <typename I, typename S1, typename S2>
34 void print_pair_sequence(std::ostream& device,
35 I begin, I end,
36 S1 print_fn1,
37 S2 print_fn2,
38 const std::string& pair_separator,
39 const std::string& separator)
40 {
41 for (I i = begin; i != end; i++)
42 {
43 if (i != begin) device << separator;
44 print_pair(device, *i, print_fn1, print_fn2, pair_separator);
45 }
46 }
47
48 ////////////////////////////////////////////////////////////////////////////////
49
50 } // end namespace stlplus
This page took 0.030681 seconds and 4 git commands to generate.