Skip to content

Commit

Permalink
Create shadow.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
1034569185 authored Aug 14, 2023
1 parent 462083b commit 02181e3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/群友提交/第八题/shadow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<iostream>
template<class Ty,size_t size>
struct array
{
Ty* begin() { return arr; };
Ty* end() { return arr + size; };
Ty arr[size];
};

template<typename Ty, typename...Args>
array(Ty, Args...) -> array<Ty, 1 + sizeof...(Args)>;

int main()
{
::array arr{1, 2, 3, 4, 5};
for (const auto& i : arr) {
std::cout << i << ' ';
}
}

0 comments on commit 02181e3

Please sign in to comment.