MRPT  1.9.9
integer_select.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-2020, 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 
10 #pragma once
11 
12 #include <cstdint>
13 
14 namespace mrpt
15 {
16 /** \addtogroup mrpt_int_select Templates to declare integers by byte count (in
17  * #include <mrpt/core/integer_select.h>)
18  * \ingroup mrpt_core_grp
19  * @{ */
20 
21 /** Usage: `int_select_by_bytecount<N>::type var;` allows defining var as a
22  * signed integer with, at least, N bytes. */
23 template <unsigned int num_bytes>
25 template <>
27 {
28  using type = int8_t;
29 };
30 template <>
32 {
33  using type = int16_t;
34 };
35 template <>
37 {
38  using type = int32_t;
39 };
40 template <>
42 {
43  using type = int32_t;
44 };
45 template <>
47 {
48  using type = int64_t;
49 };
50 
51 /** Usage: `uint_select_by_bytecount<N>::type var;` allows defining var as a
52  * unsigned integer with, at least, N bytes. */
53 template <unsigned int num_bytes>
55 template <>
57 {
58  using type = uint8_t;
59 };
60 template <>
62 {
63  using type = uint16_t;
64 };
65 template <>
67 {
68  using type = uint32_t;
69 };
70 template <>
72 {
73  using type = uint32_t;
74 };
75 template <>
77 {
78  using type = uint64_t;
79 };
80 
81 /** @} */
82 } // namespace mrpt
Usage: uint_select_by_bytecount<N>::type var; allows defining var as a unsigned integer with...
Usage: int_select_by_bytecount<N>::type var; allows defining var as a signed integer with...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020