#include<iostream>
template < class Type, int N >struct Point
{
template<class ... Args> Point( Args&&... args )
{
const Type arr[]={ args... };
enum { SIZE = sizeof(arr)/sizeof(Type) };
static_assert(SIZE<= N, "INVALID_SIZE");
for(size_t n=0;n<SIZE;++n) m_values[n]=arr[n];
for(size_t n=SIZE;n<N;++n) m_values[n]=0;
}
void View()const
{
std::cout<<"---BEGIN--------------------------\n";
for(size_t n=0;n<N;++n) std::cout<<n<<") "<<m_values[n]<<'\n';
std::cout<<"---END----------------------------\n";
}
Type m_values[N];
};
int main()
{
int v=10;
Point<int,10> p(1,2,3,4,v);
p.View();
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+Cgp0ZW1wbGF0ZSA8IGNsYXNzIFR5cGUsIGludCBOID5zdHJ1Y3QgUG9pbnQKewogICAgdGVtcGxhdGU8Y2xhc3MgLi4uIEFyZ3M+IFBvaW50KCBBcmdzJiYuLi4gYXJncyApIAogICAgewogICAgICAgIGNvbnN0IFR5cGUgYXJyW109eyBhcmdzLi4uIH07CiAgICAgICAgCiAgICAgICAgZW51bSB7IFNJWkUgPSBzaXplb2YoYXJyKS9zaXplb2YoVHlwZSkgfTsKICAgICAgICAKICAgICAgICBzdGF0aWNfYXNzZXJ0KFNJWkU8PSBOLCAiSU5WQUxJRF9TSVpFIik7CgogICAgICAgIGZvcihzaXplX3Qgbj0wO248U0laRTsrK24pIG1fdmFsdWVzW25dPWFycltuXTsKICAgICAgICBmb3Ioc2l6ZV90IG49U0laRTtuPE47KytuKSBtX3ZhbHVlc1tuXT0wOwogICAgfQoKICAgIHZvaWQgVmlldygpY29uc3QKICAgIHsKICAgICAgICBzdGQ6OmNvdXQ8PCItLS1CRUdJTi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4iOwogICAgICAgIGZvcihzaXplX3Qgbj0wO248TjsrK24pIHN0ZDo6Y291dDw8bjw8IikgIjw8bV92YWx1ZXNbbl08PCdcbic7CiAgICAgICAgc3RkOjpjb3V0PDwiLS0tRU5ELS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuIjsKICAgIH0KICAgIFR5cGUgbV92YWx1ZXNbTl07Cn07CiAKCmludCBtYWluKCkKewogICAgaW50IHY9MTA7CiAgICBQb2ludDxpbnQsMTA+IHAoMSwyLDMsNCx2KTsKICAgIHAuVmlldygpOwogICAgcmV0dXJuIDA7Cn0=