Currently I have:
template struct typename_struct {
static char const* name() {
return (std::string(typename_struc
Alternative way without using recursive templates (but requires C++14):
#include
template using is = std::integer_sequence;
template using make_is = std::make_integer_sequence;
constexpr auto size(const char*s) { int i = 0; while(*s!=0){++i;++s;} return i; }
template
struct concat_impl;
template
struct concat_impl, S2, is> {
static constexpr const char value[]
{
S1[I1]..., S2[I2]..., 0
};
};
template
constexpr auto concat {
concat_impl, S2, make_is>::value
};
Example:
constexpr const char a[] = "int";
constexpr const char c[] = "**";
#include
int main()
{
std::cout << concat << '\n';
}
append characters to string can also be implemented like this, by replacing the second const char* parameter with char....