forked from Mq-b/Loser-HomeWork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
606e22d
commit 719fb1d
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
template<class Ty,size_t size> | ||
struct array { | ||
Ty* begin() { return arr; }; | ||
Ty* end() { return arr + size; }; | ||
Ty arr[size]; | ||
}; | ||
|
||
template<class T_, class... 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 << ' '; | ||
} | ||
} |