#include <type_traits>
#include <iterator>
#include <iostream>
template < typename T, std::size_t N > struct c_array
{
static_assert( std::is_pod<T>::value, "must be a pod!" ) ;
static_assert( N, "size must be a non-zero!" ) ;
c_array() : a { T() } {}
template < typename... U > c_array( U&&... args ) : a { args... } {} // ??
T& operator[] ( std::size_t p ) { return a[p] ; }
const T& operator[] ( std::size_t p ) const { return a[p] ; }
T* begin() { return std::begin(a) ; }
T* end() { return std::end(a) ; }
const T* begin() const { return std::begin(a) ; }
const T* end() const { return std::end(a) ; }
T a[N] ;
};
int main()
{
c_array<int,5> a ;
for( auto i : a ) std::cout << i << ' ' ; std::cout << '\n' ;
c_array<long,6> b { 1, 2, 3, 4 };
for( auto i : b ) std::cout << i << ' ' ; std::cout << '\n' ;
}
I2luY2x1ZGUgPHR5cGVfdHJhaXRzPgojaW5jbHVkZSA8aXRlcmF0b3I+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnRlbXBsYXRlIDwgdHlwZW5hbWUgVCwgc3RkOjpzaXplX3QgTiA+IHN0cnVjdCBjX2FycmF5CnsKICAgIHN0YXRpY19hc3NlcnQoIHN0ZDo6aXNfcG9kPFQ+Ojp2YWx1ZSwgIm11c3QgYmUgYSBwb2QhIiApIDsKICAgIHN0YXRpY19hc3NlcnQoIE4sICJzaXplIG11c3QgYmUgYSBub24temVybyEiICkgOwoKICAgIGNfYXJyYXkoKSA6IGEgeyBUKCkgfSB7fQogICAgdGVtcGxhdGUgPCB0eXBlbmFtZS4uLiBVID4gY19hcnJheSggVSYmLi4uIGFyZ3MgKSA6IGEgeyBhcmdzLi4uIH0ge30gLy8gPz8KCiAgICBUJiBvcGVyYXRvcltdICggc3RkOjpzaXplX3QgcCApIHsgcmV0dXJuIGFbcF0gOyB9CiAgICBjb25zdCBUJiBvcGVyYXRvcltdICggc3RkOjpzaXplX3QgcCApIGNvbnN0IHsgcmV0dXJuIGFbcF0gOyB9CgogICAgVCogYmVnaW4oKSB7IHJldHVybiBzdGQ6OmJlZ2luKGEp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