MRPT  1.9.9
num_to_string.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <cstddef> //size_t
12 
13 namespace mrpt
14 {
15 namespace typemeta
16 {
17 namespace detail
18 {
19 template <unsigned... digits>
20 struct to_chars
21 {
22  static const char value[sizeof...(digits) + 1];
23 };
24 
25 template <unsigned... digits>
26 constexpr char to_chars<digits...>::value[sizeof...(digits) + 1] = {
27  ('0' + digits)..., 0};
28 
29 template <unsigned rem, unsigned... digits>
30 struct explode : explode<rem / 10, rem % 10, digits...>
31 {
32 };
33 
34 template <unsigned... digits>
35 struct explode<0, digits...> : to_chars<digits...>
36 {
37 };
38 } // namespace detail
39 
40 /** constexpr string representation of a number.
41  * Use: `num_to_string<NUMBER>::value`.
42  * \note Credits: https://stackoverflow.com/a/24000041/1631514 */
43 template <unsigned num>
45 {
46 };
47 } // namespace typemeta
48 } // namespace mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLsizei const GLfloat * value
Definition: glext.h:4134
constexpr string representation of a number.
Definition: num_to_string.h:44



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019