MRPT  2.0.0
List of all members | Static Public Member Functions
mrpt::typemeta::TTypeName< T > Struct Template Reference

Detailed Description

template<typename T>
struct mrpt::typemeta::TTypeName< T >

A template to obtain the type of its argument as a string at compile time.

It works with all classes derived from CObject, plus many specializations for the plain data types (bool, double, uint8_t, etc...) For example:

cout << TTypeName<double>::get() << endl; // "double"
cout << TTypeName<CPose2D>::get() << endl; // "CPose2D"

Users can extend this for custom structs/classes with the macro DECLARE_CUSTOM_TTYPENAME:

class MyClass { ... };
cout << TTypeName<MyClass>::get() << endl; // "MyClass"

or alternatively, to avoid adding out-of-class macros:

namespace MyNS {
class MyClass {
};
}
cout << TTypeName<MyNS::MyClass>::get() << endl; // "MyNS::MyClass"

The following types are NOT ALLOWED since they have platform-dependant sizes:

Examples:
typemeta_TTypeName/test.cpp.

Definition at line 69 of file TTypeName.h.

#include <mrpt/typemeta/TTypeName.h>

Static Public Member Functions

static constexpr auto get ()
 

Member Function Documentation

◆ get()

template<typename T>
static constexpr auto mrpt::typemeta::TTypeName< T >::get ( )
inlinestatic



Page generated by Doxygen 1.8.14 for MRPT 2.0.0 Git: b38439d21 Tue Mar 31 19:58:06 2020 +0200 at miƩ abr 1 00:50:30 CEST 2020