Intriguing question.
Avoiding using StrConst , in the following example you can see a way to get the type std::tuple<std::integral_constant<std::size_t, Pos1>, std::integral_constant<std::size_t, Pos2>, ...> .
First of all, use arrayConverter() to convert a char const * to std::array<char, N> ( lc in the following code); second: use tupleIndexGenerator<lc.size(), lc, '^'>::type to get the requested type.
So, if "hello^world^" is a string, from tupleIndexGenerator<lc.size(), lc, '^'>::type you get std::tuple<std::integral_constant<std::size_t, 5U>, std::integral_constant<std::size_t, 11U>>
The code
#include <iostream> #include <array> #include <tuple> template <typename, typename> struct typeConcat; template <typename T0, template <typename ...> class C, typename ... Ts> struct typeConcat<T0, C<Ts...>> { using type = C<T0, Ts...>; }; template <std::size_t N, std::array<char, N> const & A, char CH, std::size_t Pos = 0U, bool EQ = ((Pos < N) && (A.at(Pos) == CH))> struct tupleIndexGenerator; template <std::size_t N, std::array<char, N> const & A, char CH> struct tupleIndexGenerator<N, A, CH, N, false> { using type = std::tuple<>; }; template <std::size_t N, std::array<char, N> const & A, char CH, std::size_t Pos> struct tupleIndexGenerator<N, A, CH, Pos, false> { using type = typename tupleIndexGenerator<N, A, CH, Pos+1U>::type; }; template <std::size_t N, std::array<char, N> const & A, char CH, std::size_t Pos> struct tupleIndexGenerator<N, A, CH, Pos, true> { using type = typename typeConcat< std::integral_constant<std::size_t, Pos>, typename tupleIndexGenerator<N, A, CH, Pos+1U>::type>::type; }; template <typename T, size_t N, size_t ... Is> constexpr auto arrayConverter (T const (&arr)[N], std::index_sequence<Is...> const &) { return std::array<T, N> { { arr[Is]... } }; } template <typename T, size_t N> constexpr auto arrayConverter (T const (&arr)[N]) { return arrayConverter(arr, std::make_index_sequence<N>{}); } constexpr auto lc = arrayConverter("hello^world^"); int main () { static_assert(std::is_same< typename tupleIndexGenerator<lc.size(), lc, '^'>::type, std::tuple<std::integral_constant<std::size_t, 5U>, std::integral_constant<std::size_t, 11U>>>::value, "!"); }