1 ////////////////////////////////////////////////////////////////////////////////
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
8 ////////////////////////////////////////////////////////////////////////////////
9 #include "string_pair.hpp"
14 ////////////////////////////////////////////////////////////////////////////////
15 // any forward iterator sequence
17 template <typename I, typename S>
18 std::string sequence_to_string(I begin,
21 const std::string& separator)
24 for (I i = begin; i != end; i++)
26 if (i != begin) result += separator;
27 result += to_string(*i);
32 ////////////////////////////////////////////////////////////////////////////////
33 // any sequence where the value is a pair
35 template <typename I, typename S1, typename S2>
36 std::string pair_sequence_to_string(I begin,
40 const std::string& pair_separator,
41 const std::string& separator)
44 for (I i = begin; i != end; i++)
46 if (i != begin) result += separator;
47 result += pair_to_string(*i, to_string_fn1, to_string_fn2, pair_separator);
52 ////////////////////////////////////////////////////////////////////////////////
54 } // end namespace stlplus