Main MRPT website > C++ reference for MRPT 1.9.9
format.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/core/common.h>
13 #include <string>
14 
15 /** This is the global namespace for all Mobile Robot Programming Toolkit (MRPT)
16  * libraries. */
17 namespace mrpt
18 {
19 /** A std::string version of C sprintf.
20  * You can call this to obtain a std::string using printf-like syntax.
21  */
22 std::string format(const char* fmt, ...) MRPT_printf_format_check(1, 2);
23 
24 /** Just like std::to_string(), but with an overloaded version
25 * for std::string arguments. */
26 template <typename T>
27 std::string to_string(T v)
28 {
29  return std::to_string(v);
30 }
31 template <>
32 inline std::string to_string<>(std::string v)
33 {
34  return v;
35 }
36 template <>
37 inline std::string to_string<>(bool v)
38 {
39  return v ? "true" : "false";
40 }
41 template <>
42 inline std::string to_string<>(const char* s)
43 {
44  return std::string(s);
45 }
46 }
s
GLdouble s
Definition: glext.h:3676
mrpt::to_string
std::string std::string to_string(T v)
Just like std::to_string(), but with an overloaded version for std::string arguments.
Definition: format.h:27
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
v
const GLdouble * v
Definition: glext.h:3678
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
MRPT_printf_format_check
#define MRPT_printf_format_check(_FMT_, _VARARGS_)
Definition: common.h:158
common.h
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::to_string
std::string to_string(const char *s)
Definition: format.h:42



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST