Currently, one can use __PRETTY_FUNCTION__
to display a template type under gcc
, and clang
:
#include <iostream>
template <class T>
void print_type() {
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
int main(int argc, char* argv[]) {
print_type<const volatile int&>();
return 0;
}
Will output:
void print_type() [with T = const volatile int&]
With the reflection TS coming and reflection facilities in C++, I was wondering what the syntax would look like to be able to do something similar.
Note: as the reflection TS has not been voted in yet, I am only looking for a "probable" syntax.
Aucun commentaire:
Enregistrer un commentaire