22 #if defined(ARMA_USE_BOOST_FORMAT) 25 using boost::basic_format;
30 #if defined(ARMA_HAVE_STD_SNPRINTF) 32 #define arma_snprintf std::snprintf 54 out[size-1] = char(0);
84 template<
typename T1,
typename T2>
104 template<
typename T2>
114 template<
typename T1,
typename T2,
typename T3>
119 return basic_format< basic_format<T1,T2>, T3 >(X, arg);
124 template<
typename T2>
129 char local_buffer[1024];
130 char* buffer = local_buffer;
132 int buffer_size = 1024;
133 int required_size = buffer_size;
135 bool using_local_buffer =
true;
141 if(using_local_buffer ==
false)
143 buffer =
new char[buffer_size];
146 required_size =
arma_snprintf(buffer,
size_t(buffer_size), X.
A.A.c_str(), X.
B);
148 if(required_size < buffer_size)
150 if(required_size > 0)
160 if(using_local_buffer ==
true)
162 using_local_buffer =
false;
169 }
while( (required_size >= buffer_size) );
176 template<
typename T2,
typename T3>
181 char local_buffer[1024];
182 char* buffer = local_buffer;
184 int buffer_size = 1024;
185 int required_size = buffer_size;
187 bool using_local_buffer =
true;
193 if(using_local_buffer ==
false)
195 buffer =
new char[buffer_size];
198 required_size =
arma_snprintf(buffer,
size_t(buffer_size), X.A.A.A.c_str(), X.A.B, X.B);
200 if(required_size < buffer_size)
202 if(required_size > 0)
212 if(using_local_buffer ==
true)
214 using_local_buffer =
false;
221 }
while( (required_size >= buffer_size) );
228 template<
typename T2,
typename T3,
typename T4>
233 char local_buffer[1024];
234 char* buffer = local_buffer;
236 int buffer_size = 1024;
237 int required_size = buffer_size;
239 bool using_local_buffer =
true;
245 if(using_local_buffer ==
false)
247 buffer =
new char[buffer_size];
250 required_size =
arma_snprintf(buffer,
size_t(buffer_size), X.A.A.A.A.c_str(), X.A.A.B, X.A.B, X.B);
252 if(required_size < buffer_size)
254 if(required_size > 0)
264 if(using_local_buffer ==
true)
266 using_local_buffer =
false;
273 }
while( (required_size >= buffer_size) );
280 template<
typename T2,
typename T3,
typename T4,
typename T5>
285 char local_buffer[1024];
286 char* buffer = local_buffer;
288 int buffer_size = 1024;
289 int required_size = buffer_size;
291 bool using_local_buffer =
true;
297 if(using_local_buffer ==
false)
299 buffer =
new char[buffer_size];
302 required_size =
arma_snprintf(buffer,
size_t(buffer_size), X.A.A.A.A.A.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
304 if(required_size < buffer_size)
306 if(required_size > 0)
316 if(using_local_buffer ==
true)
318 using_local_buffer =
false;
325 }
while( (required_size >= buffer_size) );
332 template<
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
337 char local_buffer[1024];
338 char* buffer = local_buffer;
340 int buffer_size = 1024;
341 int required_size = buffer_size;
343 bool using_local_buffer =
true;
349 if(using_local_buffer ==
false)
351 buffer =
new char[buffer_size];
354 required_size =
arma_snprintf(buffer,
size_t(buffer_size), X.A.A.A.A.A.A.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
356 if(required_size < buffer_size)
358 if(required_size > 0)
368 if(using_local_buffer ==
true)
370 using_local_buffer =
false;
377 }
while( (required_size >= buffer_size) );
384 template<
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
389 char local_buffer[1024];
390 char* buffer = local_buffer;
392 int buffer_size = 1024;
393 int required_size = buffer_size;
395 bool using_local_buffer =
true;
401 if(using_local_buffer ==
false)
403 buffer =
new char[buffer_size];
406 required_size =
arma_snprintf(buffer,
size_t(buffer_size), X.A.A.A.A.A.A.A.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
408 if(required_size < buffer_size)
410 if(required_size > 0)
420 if(using_local_buffer ==
true)
422 using_local_buffer =
false;
429 }
while( (required_size >= buffer_size) );
436 template<
typename T1>
453 template<
typename T1,
typename T2>
470 template<
typename T1,
typename T2>
480 template<
typename T1,
typename T2>
483 operator<< (std::ostream& o, const basic_format<T1,T2>& X)
502 #if defined(ARMA_USE_BOOST_FORMAT) 506 template<
typename T1,
typename T2>
512 template<
typename T1>
525 template<
typename T1>
538 template<
typename T1>
std::string str(const basic_format< format, T2 > &X)
basic_format< format, T2 > operator%(const format &X, const T2 &arg)
std::string str(const basic_format< T1, T2 > &X)
#define arma_ignore(variable)
namespace for functions and classes which partially emulate Boost functionality
int arma_snprintf(char *out, size_t size, const char *fmt,...)
static const T1 & str_wrapper(const T1 &x, const typename string_only< T1 >::result *junk=0)