#include <iostream>
#include <cstddef>

template <char...>
struct string
{
	static const char c_str[];
};

template <char... S>
const char string<S...>::c_str[] = { S..., 0 };

template <typename T>
struct valdef
{
	typedef T value;
};

template <std::size_t...>
struct indices
{};

template <std::size_t, typename>
struct push_back;

template <std::size_t I, std::size_t... II>
struct push_back<I, indices<II...>>
	: valdef<indices<II..., I>>
{};

template <std::size_t N>
struct make_indices_impl
	: valdef
	<
		typename push_back
		<
			N,
			typename make_indices_impl<N - 1>::value
		>::value
	>
{};

template <>
struct make_indices_impl<0>
	: valdef<indices<0>>
{};

template <std::size_t N>
struct make_indices
	: valdef<typename make_indices_impl<N - 1>::value>
{};

template <>
struct make_indices<0>
	: valdef<indices<>>
{};

template <char const*, typename>
struct to_meta_string_impl;

template <char const* S, std::size_t... I>
struct to_meta_string_impl<S, indices<I...>>
	: valdef<string<S[I]...>>
{};

template <char const* S, std::size_t N>
struct to_meta_string
	: valdef
	<
		typename to_meta_string_impl
		<
			S,
			typename make_indices<N>::value
		>::value
	>
{};

struct static_string
{
	static constexpr char value[];
};

constexpr char static_string::value[] = "abcdef";

int main()
{
	std::cout << to_meta_string<static_string::value, 6>::value::c_str;
}