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
#define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC(_CONTAINER)
Definition: TTypeName_stl.h:63
STL namespace.
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:65
constexpr auto literal(const char(&lit)[N_PLUS_1]) -> string_literal< N_PLUS_1 - 1 >
Definition: static_string.h:43
#define MRPT_DECLARE_TTYPENAME_CONTAINER(_CONTAINER)
Definition: TTypeName_stl.h:32
GLsizei const GLchar ** string
Definition: glext.h:4101
#define MRPT_DECLARE_TTYPENAME_CONTAINER_FIX_SIZE(_CONTAINER)
Definition: TTypeName_stl.h:49
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static constexpr auto get()
Definition: TTypeName.h:67
#define MRPT_DECLARE_TTYPENAME(_TYPE)
Definition: TTypeName.h:107



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019