]> Dogcows Code - chaz/yoink/blob - src/stlplus/strings/string_matrix.tpp
testing new non-autotools build system
[chaz/yoink] / src / stlplus / strings / string_matrix.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
10 namespace stlplus
11 {
12
13 ////////////////////////////////////////////////////////////////////////////////
14
15 template<typename T, typename S>
16 std::string matrix_to_string(const matrix<T>& values,
17 S to_string_fn,
18 const std::string& column_separator,
19 const std::string& row_separator)
20 {
21 std::string result;
22 for (unsigned r = 0; r < values.rows(); r++)
23 {
24 if (r != 0) result += row_separator;
25 for (unsigned c = 0; c < values.columns(); c++)
26 {
27 if (c != 0) result += column_separator;
28 result += to_string_fn(values(r,c));
29 }
30 }
31 return result;
32 }
33
34 } // end namespace stlplus
35
This page took 0.036148 seconds and 4 git commands to generate.