stupid md
This commit is contained in:
parent
093e50fa3f
commit
2420a8c61a
2 changed files with 7 additions and 2 deletions
|
@ -7,18 +7,22 @@ The default arguments make it use `std::cout` and an empty string as input.
|
||||||
|
|
||||||
|
|
||||||
You can also use a string as input:
|
You can also use a string as input:
|
||||||
|
|
||||||
brainfuck(",[.,]", "input");
|
brainfuck(",[.,]", "input");
|
||||||
|
|
||||||
Or with a stream/container/iterator:
|
Or with a stream/container/iterator:
|
||||||
|
|
||||||
brainfuck(",[.,]", std::input_iterator<char>(std::cin));
|
brainfuck(",[.,]", std::input_iterator<char>(std::cin));
|
||||||
|
|
||||||
|
|
||||||
You can specify the memory-units:
|
You can specify the memory-units:
|
||||||
|
|
||||||
brainfuck<int>("...");
|
brainfuck<int>("...");
|
||||||
As long as the type has certain operators. The default output is comma-seperated, except for char.
|
As long as the type has certain operators. The default output is comma-seperated, except for char.
|
||||||
|
|
||||||
|
|
||||||
You can specify an output-iterator:
|
You can specify an output-iterator:
|
||||||
|
|
||||||
brainfuck("...", "", std::back_inserter(my_vector));
|
brainfuck("...", "", std::back_inserter(my_vector));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
counted
|
counted
|
||||||
=======
|
=======
|
||||||
|
|
||||||
```C++
|
```c++
|
||||||
for(auto x : counted(v)) {
|
for(auto x : counted(v)) {
|
||||||
... x.value ... x.index ...
|
... x.value ... x.index ...
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ There is no const version of it. Doing `for(const auto x : counted(v))` doesn't
|
||||||
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```C++
|
|
||||||
|
```c++
|
||||||
for(auto x : counted(v)) {
|
for(auto x : counted(v)) {
|
||||||
std::cout << "v[" << x.index << "] = " << x.value << std::endl;
|
std::cout << "v[" << x.index << "] = " << x.value << std::endl;
|
||||||
x.value *= 2;
|
x.value *= 2;
|
||||||
|
|
Reference in a new issue