-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace util { | ||
template<std::size_t N> | ||
using c_str = char const [N]; | ||
|
||
template<auto const & str, std::size_t iter = std::size(str), char const ... chars> | ||
struct c_str_to_arg_pack { | ||
using arg_pack_t = | ||
typename c_str_to_arg_pack<str, iter-1, str[iter-1], chars ... > | ||
::arg_pack_t; | ||
}; | ||
|
||
template<auto const & str, char const ... chars> | ||
struct c_str_to_arg_pack<str, 0, chars ...> { | ||
using arg_pack_t = c_str_to_arg_pack<str, 0, chars...>; | ||
|
||
template <template <char ...> typename T> | ||
using apply = T<chars ...>; | ||
}; | ||
template<auto const & str, char const ... chars> | ||
using c_str_to_arg_pack_t = typename c_str_to_arg_pack<str, chars ... >::arg_pack_t; | ||
|
||
} |