#include <array>
#include <iostream>
#include <utility>
namespace detail
{
template <typename T, std::size_t...Is>
std::array<T, sizeof...(Is)> make_array(const T& value, std::index_sequence<Is...>)
{
return {{(static_cast<void>(Is), value)...}};
}
}
template <std::size_t N, typename T>
std::array<T, N> make_array(const T& value)
{
return detail::make_array(value, std::make_index_sequence<N>());
}
int main()
{
auto a = make_array<42>('.');
for (auto c : a) {
std::cout << c;
}
std::cout << std::endl;
}
I2luY2x1ZGUgPGFycmF5PgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx1dGlsaXR5PgoKbmFtZXNwYWNlIGRldGFpbAp7CgogICAgdGVtcGxhdGUgPHR5cGVuYW1lIFQsIHN0ZDo6c2l6ZV90Li4uSXM+CiAgICBzdGQ6OmFycmF5PFQsIHNpemVvZi4uLihJcyk+IG1ha2VfYXJyYXkoY29uc3QgVCYgdmFsdWUsIHN0ZDo6aW5kZXhfc2VxdWVuY2U8SXMuLi4+KQogICAgewogICAgICAgIHJldHVybiB7eyhzdGF0aWNfY2FzdDx2b2lkPihJcyksIHZhbHVlKS4uLn19OwogICAgfQp9Cgp0ZW1wbGF0ZSA8c3RkOjpzaXplX3QgTiwgdHlwZW5hbWUgVD4Kc3RkOjphcnJheTxULCBOPiBtYWtlX2FycmF5KGNvbnN0IFQmIHZhbHVlKQp7CiAgICByZXR1cm4gZGV0YWlsOjptYWtlX2FycmF5KHZhbHVlLCBzdGQ6Om1ha2VfaW5kZXhfc2VxdWVuY2U8Tj4oKSk7Cn0KCmludCBtYWluKCkKewogICAgYXV0byBhID0gbWFrZV9hcnJheTw0Mj4oJy4nKTsKIAogICAgZm9yIChhdXRvIGMgOiBhKSB7CiAgICAgICAgc3RkOjpjb3V0IDw8IGM7ICAgCiAgICB9CiAgICBzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwp9Cg==