OpenPFC  0.1.4
Phase Field Crystal simulation framework
Loading...
Searching...
No Matches
typename.hpp File Reference

Get human-readable type names at runtime. More...

#include <complex>
#include <string>
#include <type_traits>
#include <typeinfo>
Include dependency graph for typename.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pfc::TypeName< T >
 
struct  pfc::TypeName< int >
 
struct  pfc::TypeName< float >
 
struct  pfc::TypeName< double >
 
struct  pfc::TypeName< std::complex< T > >
 

Detailed Description

Get human-readable type names at runtime.

This header provides the TypeName<T> template struct for obtaining human-readable string representations of C++ types.

The generic template uses typeid().name() (compiler-dependent), while specializations provide clean names for common types:

  • int, float, double
  • std::complex<float>, std::complex<double>

This is useful for:

  • Debug output and logging
  • Error messages
  • Runtime type inspection
  • Generic template code that needs to report types
std::cout << pfc::TypeName<double>::get() << std::endl; // "double"
std::cout << pfc::TypeName<std::complex<float>>::get(); // "complex<float>"
Get human-readable type names at runtime.
See also
utils/show.hpp for usage in array display
utils.hpp for other utility functions
Author
OpenPFC Development Team
Date
2025