]> Dogcows Code - chaz/yoink/blobdiff - src/stlplus/strings/print_sequence.tpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / strings / print_sequence.tpp
diff --git a/src/stlplus/strings/print_sequence.tpp b/src/stlplus/strings/print_sequence.tpp
new file mode 100644 (file)
index 0000000..cea8056
--- /dev/null
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////////\r
+\r
+//   Author:    Andy Rushton\r
+//   Copyright: (c) Southampton University 1999-2004\r
+//              (c) Andy Rushton           2004-2009\r
+//   License:   BSD License, see ../docs/license.html\r
+\r
+////////////////////////////////////////////////////////////////////////////////\r
+#include "print_pair.hpp"\r
+\r
+namespace stlplus\r
+{\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // any forward iterator sequence\r
+\r
+  template <typename I, typename S>\r
+  void print_sequence(std::ostream& device,\r
+                      I begin, I end, \r
+                      S print_fn,\r
+                      const std::string& separator)\r
+  {\r
+    for (I i = begin; i != end; i++)\r
+    {\r
+      if (i != begin) device << separator;\r
+      print_fn(device, *i);\r
+    }\r
+  }\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+  // any sequence where the value is a pair\r
+\r
+  template <typename I, typename S1, typename S2>\r
+  void print_pair_sequence(std::ostream& device,\r
+                           I begin, I end,\r
+                           S1 print_fn1,\r
+                           S2 print_fn2,\r
+                           const std::string& pair_separator,\r
+                           const std::string& separator)\r
+  {\r
+    for (I i = begin; i != end; i++)\r
+    {\r
+      if (i != begin) device << separator;\r
+      print_pair(device, *i, print_fn1, print_fn2, pair_separator);\r
+    }\r
+  }\r
+\r
+  ////////////////////////////////////////////////////////////////////////////////\r
+\r
+} // end namespace stlplus\r
This page took 0.022767 seconds and 4 git commands to generate.