Skip to content

Commit e687a78

Browse files
authored
Update 016_array_to_array.cpp
1 parent e1a8eec commit e687a78

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎cpp_20/016_array_to_array.cpp‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
1
1+
template<class T, size_t N, class V>
2+
std::array<T, N> to_array(const V& v)
3+
{
4+
assert(v.size() == N);
5+
std::array<T, N> d;
6+
std::copy(v.begin(), v.end(), d.data());
7+
return d;
8+
}

0 commit comments

Comments
 (0)