@@ -61,7 +61,7 @@ namespace dynamicgraph {
61
61
#define SEND_WARNING_STREAM_MSG (msg ) SEND_MSG(msg, MSG_TYPE_WARNING_STREAM)
62
62
#define SEND_ERROR_STREAM_MSG (msg ) SEND_MSG(msg, MSG_TYPE_ERROR_STREAM)
63
63
64
- /* template<typename T>
64
+ template <typename T>
65
65
std::string toString (const T& v, const int precision=3 , const int width=-1 )
66
66
{
67
67
std::stringstream ss;
@@ -70,20 +70,20 @@ std::string toString(const T& v, const int precision=3, const int width=-1)
70
70
else
71
71
ss<<std::fixed<<std::setprecision (precision)<<v;
72
72
return ss.str ();
73
- }*/
73
+ }
74
74
75
75
template <typename T>
76
76
std::string toString (const std::vector<T> &v, const int precision = 3 ,
77
77
const int width = -1 , const std::string separator = " , " ) {
78
78
std::stringstream ss;
79
79
if (width > precision) {
80
- for (int i = 0 ; i < v.size () - 1 ; i++)
80
+ for (unsigned int i = 0 ; i < v.size () - 1 ; i++)
81
81
ss << std::fixed << std::setw (width) << std::setprecision (precision)
82
82
<< v[i] << separator;
83
83
ss << std::fixed << std::setw (width) << std::setprecision (precision)
84
84
<< v[v.size () - 1 ];
85
85
} else {
86
- for (int i = 0 ; i < v.size () - 1 ; i++)
86
+ for (unsigned int i = 0 ; i < v.size () - 1 ; i++)
87
87
ss << std::fixed << std::setprecision (precision) << v[i] << separator;
88
88
ss << std::fixed << std::setprecision (precision) << v[v.size () - 1 ];
89
89
}
@@ -96,13 +96,13 @@ std::string toString(const Eigen::MatrixBase<T> &v, const int precision = 3,
96
96
const int width = -1 , const std::string separator = " , " ) {
97
97
std::stringstream ss;
98
98
if (width > precision) {
99
- for (int i = 0 ; i < v.size () - 1 ; i++)
99
+ for (unsigned int i = 0 ; i < v.size () - 1 ; i++)
100
100
ss << std::fixed << std::setw (width) << std::setprecision (precision)
101
101
<< v[i] << separator;
102
102
ss << std::fixed << std::setw (width) << std::setprecision (precision)
103
103
<< v[v.size () - 1 ];
104
104
} else {
105
- for (int i = 0 ; i < v.size () - 1 ; i++)
105
+ for (unsigned int i = 0 ; i < v.size () - 1 ; i++)
106
106
ss << std::fixed << std::setprecision (precision) << v[i] << separator;
107
107
ss << std::setprecision (precision) << v[v.size () - 1 ];
108
108
}
0 commit comments