Skip to content

Commit 614b8e2

Browse files
committed
Write a helper which implodes a type list into an actual C-string
1 parent bb2e4a5 commit 614b8e2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

charlist.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,19 @@ struct string_list<Str, Pos, '\0'> {
4040
template <class Str>
4141
using string_list_t = typename string_list<Str, 0, Str::str()[0]>::type;
4242

43+
template <typename typelist, char ... chars>
44+
struct tl_to_varlist;
45+
46+
template <char c, typename restlist, char ... chars>
47+
struct tl_to_varlist<tl::tl<char_t<c>, restlist>, chars...>
48+
: public tl_to_varlist<restlist, chars..., c>
49+
{ };
50+
51+
template <char ... chars>
52+
struct tl_to_varlist<tl::null_t, chars...> {
53+
static const char * const str() {
54+
static constexpr const char string[] = {chars..., '\0'};
55+
return string;
56+
}
57+
};
58+

0 commit comments

Comments
 (0)