#include <iostream>
#include <array>
template<typename T, size_t SZ> void timesTwo(std::array<T, SZ>& arr) {
for (auto& a : arr) {
a *= 2;
}
}
int main() {
std::array<int, 5> arr1 = { 1, 2, 3, 4, 5 };
std::array<int, 16> arr2;
arr2.fill(0);
for (int i = 1; i < 16; i++) {
int temp = arr2[i - 1] * 2;
arr2[i] = (temp ? temp : 1);
}
std::array<float, 3> arr3 = { 1.1, 2.2, 3.3 };
timesTwo(arr1);
timesTwo(arr2);
timesTwo(arr3);
for (auto& a : arr1) {
std::cout << a << " ";
}
std::cout << std::endl;
for (auto& a : arr2) {
std::cout << a << " ";
}
std::cout << std::endl;
for (auto& a : arr3) {
std::cout << a << " ";
}
std::cout << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YXJyYXk+Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBULCBzaXplX3QgU1o+IHZvaWQgdGltZXNUd28oc3RkOjphcnJheTxULCBTWj4mIGFycikgewoJZm9yIChhdXRvJiBhIDogYXJyKSB7CgkJYSAqPSAyOwoJfQp9CgoKaW50IG1haW4oKSB7CglzdGQ6OmFycmF5PGludCwgNT4gYXJyMSA9IHsgMSwgMiwgMywgNCwgNSB9OwoKCXN0ZDo6YXJyYXk8aW50LCAxNj4gYXJyMjsKCWFycjIuZmlsbCgwKTsKCWZvciAoaW50IGkgPSAxOyBpIDwgMTY7IGkrKykgewoJCWludCB0ZW1wID0gYXJyMltpIC0gMV0gKiAyOwoJCWFycjJbaV0gPSAodGVtcCA/IHRlbXAgOiAxKTsKCX0KCQoJc3RkOjphcnJheTxmbG9hdCwgMz4gYXJyMyA9IHsgMS4xLCAyLjIsIDMuMyB9OwoJCgl0aW1lc1R3byhhcnIxKTsKCXRpbWVzVHdvKGFycjIpOwoJdGltZXNUd28oYXJyMyk7CgkKCWZvciAoYXV0byYgYSA6IGFycjEpIHsKCQlzdGQ6OmNvdXQgPDwgYSA8PCAiICI7Cgl9CglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwoJCglmb3IgKGF1dG8mIGEgOiBhcnIyKSB7CgkJc3RkOjpjb3V0IDw8IGEgPDwgIiAiOwoJfQoJc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKCQoJZm9yIChhdXRvJiBhIDogYXJyMykgewoJCXN0ZDo6Y291dCA8PCBhIDw8ICIgIjsKCX0KCXN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7Cn0=