#include <iostream>
#include <vector>
using namespace std;
template<class Iter>
auto my_func(Iter beg, Iter end)
{
return vector<typename iterator_traits<Iter>::value_type> (beg, end);
}
int main() {
int bips[] = { 3,7,0,60,17 };//Passing pointers of array
auto g = my_func(bips, bips + sizeof(bips) / sizeof(*bips));
for(const auto i : g) cout << i << '\t';
cout << endl;
vector<int> v = { 10,5,4,14 };//Passing iterators of a vector
auto h = my_func(v.begin(), v.end());
for(const auto i : h) cout << i << '\t';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRlbXBsYXRlPGNsYXNzIEl0ZXI+CmF1dG8gbXlfZnVuYyhJdGVyIGJlZywgSXRlciBlbmQpCnsKCXJldHVybiB2ZWN0b3I8dHlwZW5hbWUgaXRlcmF0b3JfdHJhaXRzPEl0ZXI+Ojp2YWx1ZV90eXBlPiAoYmVnLCBlbmQpOwp9CgppbnQgbWFpbigpIHsKICAgIGludCBiaXBzW10gPSB7IDMsNywwLDYwLDE3IH07Ly9QYXNzaW5nIHBvaW50ZXJzIG9mIGFycmF5CiAgICBhdXRvIGcgPSBteV9mdW5jKGJpcHMsIGJpcHMgKyBzaXplb2YoYmlwcykgLyBzaXplb2YoKmJpcHMpKTsKICAgIAogICAgZm9yKGNvbnN0IGF1dG8gaSA6IGcpIGNvdXQgPDwgaSA8PCAnXHQnOwogICAgY291dCA8PCBlbmRsOwoKICAgIHZlY3RvcjxpbnQ+IHYgPSB7IDEwLDUsNCwxNCB9Oy8vUGFzc2luZyBpdGVyYXRvcnMgb2YgYSB2ZWN0b3IgCiAgICBhdXRvIGggPSBteV9mdW5jKHYuYmVnaW4oKSwgdi5lbmQoKSk7CiAgICAKICAgIGZvcihjb25zdCBhdXRvIGkgOiBoKSBjb3V0IDw8IGkgPDwgJ1x0JzsgICAgCn0=