vt::util::demangle::TemplateExtract struct

Public static functions

template<class T>
static auto prettyFunctionForType() -> char const * constexpr
template<class T, T PF_VALUE_NAME>
static auto prettyFunctionForValue() -> char const * constexpr
template<class T, T* PF_VALUE_NAME>
static auto prettyFunctionForValuePtr() -> char const * constexpr
static auto singlePfType(std::string const& pf) -> std::string
static auto lastNamedPfType(std::string const& spf, std::string const& tparam) -> std::string
template<typename T>
static auto getTypeName() -> std::string
template<typename T, T value>
static auto getValueName() -> std::string
template<typename T, T* value>
static auto getValueNamePtr() -> std::string
static auto getNamespace(std::string const& typestr) -> std::string
static auto getBarename(std::string const& typestr) -> std::string
static auto getVoidFuncStrArgs(std::string const& typestr) -> std::string

Function documentation

template<class T>
static char const * vt::util::demangle::TemplateExtract::prettyFunctionForType() constexpr

IFF tracing a tracing-enabled build, returns the compiler-dependent 'PRETTY PRINT' value of the ADORNED function as a string. The only useful bit here is the "[T = ..]" of the template in scope as the function name itself is self-evident; GCC and Clang supply this. This code will simply NOT COMPILE if the compiler is lacking required support; this method cannot be used if tracing is disabled. There should probably be a cmake check..

template<class T, T PF_VALUE_NAME>
static char const * vt::util::demangle::TemplateExtract::prettyFunctionForValue() constexpr

When the goal is to extract the value "as appearing" in the template parameterization, and not the type..

static std::string vt::util::demangle::TemplateExtract::singlePfType(std::string const& pf)

Given a GCC/Clang-like PRETTY_FUNCTION output, extract the template instantiation information as a string, assuming a SINGLE template parameter. Returns an empty string if such cannot be extracted.

static std::string vt::util::demangle::TemplateExtract::lastNamedPfType(std::string const& spf, std::string const& tparam)

Given a GCG/Clang-long PRETTY_FUNCTION output, extract the template information as a string, assuming tparam names the LAST template parameter. Returns an empty string if such cannot be extracted.

template<typename T>
static std::string vt::util::demangle::TemplateExtract::getTypeName()

Return the type of T, as a string. Requires compiler extension support.

template<typename T, T value>
static std::string vt::util::demangle::TemplateExtract::getValueName()

Return the type of T, as a string. Requires compiler extension support. (Might be able to use 'auto T' in C++17.)

static std::string vt::util::demangle::TemplateExtract::getNamespace(std::string const& typestr)

Given a string like 'a::b::c', return the namespace of 'a::b'. Does not strip out extra template parameterization artifacts. Removes any leading '&', if present (as in 'values representing types').

static std::string vt::util::demangle::TemplateExtract::getBarename(std::string const& typestr)

Given a string like 'a::b::c', return the barename of 'c'. Returns the bare name in absense of any namespace (eg. 'c' -> 'c'). Removes any leading '&', if present (as in 'values representing types').

static std::string vt::util::demangle::TemplateExtract::getVoidFuncStrArgs(std::string const& typestr)

Given a string like 'void (...)' (that is, the string representation of a function type.. return the argument section. As the name indicates this is somewhat limited. Returns the original if not starting with 'void (' or ending in ')'.