Currently I have:
template struct typename_struct {
static char const* name() {
return (std::string(typename_struc
You could use something like this. Everything happens at compile time. Specialize base_typename_struct to define your primitive types.
template
struct append {
static constexpr const char* value() {
return append::value();
}
};
template
struct append {
static const char value_str[];
static constexpr const char* value() {
return value_str;
}
};
template
const char append::value_str[] = { suffix..., 0 };
template
struct base_typename_struct;
template <>
struct base_typename_struct {
static constexpr const char name[] = "int";
};
template
struct typename_struct {
typedef base_typename_struct base;
static const char* name() {
return append::value();
}
};
template
struct typename_struct:
public typename_struct {
};
int main() {
cout << typename_struct::name() << endl;
}