Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Static Public Member Functions
mrpt::utils::TTypeName< T > Struct Template Reference

Detailed Description

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

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

It works with all classes derived from CSerializable, 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"
cout << TTypeName<mrpt::maps::COccupancyGridMap2D>::get() << endl; // "COccupancyGridMap2D"

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

class MyClass { ... };
cout << TTypeName<MyClass>::get() << endl; // "MyClass"
#define DECLARE_CUSTOM_TTYPENAME(_TYPE)
Identical to MRPT_DECLARE_TTYPENAME but intended for user code.
Definition: TTypeName.h:57

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

Definition at line 47 of file TTypeName.h.

#include <mrpt/utils/TTypeName.h>

Static Public Member Functions

static std::string get ()
 

Member Function Documentation

◆ get()

template<typename T >
static std::string mrpt::utils::TTypeName< T >::get ( )
inlinestatic



Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Mon Dec 26 04:51:47 UTC 2022