General Utility Library for C++14  2.9
Classes | Functions

Detailed Description

Generating human-readable descriptions for types.


class  gul14::FailToInstantiate< T >
 A helper class to debug types. More...


template<class T >
constexpr string_view gul14::type_name ()
 Generate a human readable string describing a type. More...

Function Documentation

◆ type_name()

template<class T >
constexpr string_view gul14::type_name ( )

Generate a human readable string describing a type.

Cuts out the most relevant part of __PRETTY_FUNCTION__ of itself, ignoring all the stuff that contains information on the function itself, leaving just the description of the template parameter.

Note: __FUNCSIG__ with MSVC.

This function can only be constexpr if __PRETTY_FUNCTION__ is constexpr. This function is not constexpr with MSVC because of language limits.

Use like this:

auto& literal = "test";
std::cout << "The type is " << gul14::type_name<decltype(literal)>() << '\n';
Template Parameters
TType that shall be described
a string view that describes the type of the template parameter