2 changed files with 30 additions and 0 deletions
@ -0,0 +1,29 @@ |
|||||
|
#include <iostream> |
||||
|
|
||||
|
template<unsigned int SIZE> struct Supplier { |
||||
|
char data[5]{ 'h', 'e', 'l', 'l', 'o' }; |
||||
|
uint8_t pos{ 0 }; |
||||
|
|
||||
|
char next() |
||||
|
{ |
||||
|
pos++; |
||||
|
if (pos >= SIZE) { |
||||
|
return -34; |
||||
|
} |
||||
|
|
||||
|
return data[pos]; |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
int main() |
||||
|
{ |
||||
|
std::cout << "BEGIN" << std::endl; |
||||
|
Supplier<5> sup{}; |
||||
|
|
||||
|
|
||||
|
while (char c = true) { |
||||
|
std::cout << c; |
||||
|
} |
||||
|
|
||||
|
std::cout << "END" << std::endl; |
||||
|
} |
Loading…
Reference in new issue