Main MRPT website > C++ reference for MRPT 1.9.9
TTypeName_stl.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 #pragma once
10 
14 #include <list>
15 #include <vector>
16 #include <deque>
17 #include <set>
18 #include <map>
19 #include <array>
20 
21 /** \file This file extends TTypeName.h for STL C++ types. */
22 
23 namespace mrpt
24 {
25 namespace typemeta
26 {
27 /** @name Conversion of type to string at compile time
28 @{ */
29 
31 
32 #define MRPT_DECLARE_TTYPENAME_CONTAINER(_CONTAINER) \
33  template <typename V> \
34  struct TTypeName<_CONTAINER<V>> \
35  { \
36  constexpr static auto get() \
37  { \
38  return literal(#_CONTAINER) + literal("<") + TTypeName<V>::get() + \
39  literal(">"); \
40  } \
41  };
42 
47 
48 // array<T,N>
49 #define MRPT_DECLARE_TTYPENAME_CONTAINER_FIX_SIZE(_CONTAINER) \
50  template <typename V, std::size_t N> \
51  struct TTypeName<_CONTAINER<V, N>> \
52  { \
53  constexpr static auto get() \
54  { \
55  return literal(#_CONTAINER) + literal("<") + TTypeName<V>::get() + \
56  literal(",") + literal(num_to_string<N>::value) + \
57  literal(">"); \
58  } \
59  };
60 
62 
63 #define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC(_CONTAINER) \
64  template <typename K, typename V> \
65  struct TTypeName<_CONTAINER<K, V>> \
66  { \
67  constexpr static auto get() \
68  { \
69  return literal(#_CONTAINER) + literal("<") + TTypeName<K>::get() + \
70  literal(",") + TTypeName<V>::get() + literal(">"); \
71  } \
72  };
73 
76 
77 template <typename T1, typename T2>
78 struct TTypeName<std::pair<T1, T2>>
79 {
80  constexpr static auto get()
81  {
82  return literal("std::pair<") + TTypeName<T1>::get() + literal(",") +
83  TTypeName<T2>::get() + literal(">");
84  }
85 };
86 
87 /** @} */
88 
89 } // End of namespace
90 } // End of namespace
MRPT_DECLARE_TTYPENAME
#define MRPT_DECLARE_TTYPENAME(_TYPE)
Definition: TTypeName.h:107
mrpt::typemeta::TTypeName< std::pair< T1, T2 > >::get
constexpr static auto get()
Definition: TTypeName_stl.h:80
MRPT_DECLARE_TTYPENAME_CONTAINER
#define MRPT_DECLARE_TTYPENAME_CONTAINER(_CONTAINER)
Definition: TTypeName_stl.h:32
num_to_string.h
mrpt::typemeta::TTypeName
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:65
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
MRPT_DECLARE_TTYPENAME_CONTAINER_FIX_SIZE
#define MRPT_DECLARE_TTYPENAME_CONTAINER_FIX_SIZE(_CONTAINER)
Definition: TTypeName_stl.h:49
TTypeName.h
mrpt::typemeta::TTypeName::get
constexpr static auto get()
Definition: TTypeName.h:67
MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC
#define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC(_CONTAINER)
Definition: TTypeName_stl.h:63
string
GLsizei const GLchar ** string
Definition: glext.h:4101
static_string.h
mrpt::typemeta::literal
constexpr auto literal(const char(&lit)[N_PLUS_1]) -> string_literal< N_PLUS_1 - 1 >
Definition: static_string.h:43



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