Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Created October 27, 2020 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awesomebytes/ea6b749ad78e52d4161dfdfb2c5cbd50 to your computer and use it in GitHub Desktop.
Save awesomebytes/ea6b749ad78e52d4161dfdfb2c5cbd50 to your computer and use it in GitHub Desktop.
Get variable type user friendly name in C++

How to get the type of a variable in C++

#include <boost/units/detail/utility.hpp>
using boost::units::detail::demangle;
auto demangled_name = demangle(typeid(MY_VARIABLE).name());
std::cout << "variable is of type: '"<< demangled_name << "'" << std::endl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment