WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
Demangle.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <string>
8#include <string_view>
9#include <typeinfo>
10
11namespace wpi::util {
12
13/**
14 * Demangle a C++ symbol.
15 *
16 * @param mangledSymbol the mangled symbol.
17 * @return The demangled symbol, or mangledSymbol if demangling fails.
18 */
19std::string Demangle(std::string_view mangledSymbol);
20
21/**
22 * Returns the type name of an object
23 * @param type The object
24 */
25template <typename T>
26std::string GetTypeName(const T& type) {
27 return Demangle(typeid(type).name());
28}
29
30} // namespace wpi::util
@ name
Definition base.h:690
Definition raw_os_ostream.hpp:19
std::string GetTypeName(const T &type)
Returns the type name of an object.
Definition Demangle.hpp:26
std::string Demangle(std::string_view mangledSymbol)
Demangle a C++ symbol.