Skip to content

Commit

Permalink
与天争锋.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
HermosMerlin authored Aug 14, 2023
1 parent 462083b commit 745a231
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/群友提交/第八题/与天争锋.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>

template <class Ty, size_t size>
struct array {
Ty* begin() { return arr; };
Ty* end() { return arr + size; };
Ty arr[size];
};

template <typename T, typename... U>
array(T, U...) -> array<T, 1 + sizeof...(U)>;

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

0 comments on commit 745a231

Please sign in to comment.