Skip to content

Commit

Permalink
Merge pull request #285 from Lry722/Lry722
Browse files Browse the repository at this point in the history
提交第八题
  • Loading branch information
Mq-b authored Feb 8, 2024
2 parents 94296e5 + 082b881 commit 04cbe2b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/群友提交/第08题/Lry722.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>

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

template<typename ...Args>
array(Args &&... args) -> array<std::common_type_t<Args ...>, sizeof...(Args)>;

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

0 comments on commit 04cbe2b

Please sign in to comment.