fix examples
parent
9380d2f430
commit
d0bb1cfc16
|
@ -12,16 +12,16 @@ int main() {
|
|||
|
||||
/* algorithm: map */
|
||||
writeln("range map test");
|
||||
for (int i: map(range(10), [](int v) { return v + 0.5f; }))
|
||||
writeln(i);
|
||||
for (float f: map(range(10), [](int v) { return v + 0.5f; }))
|
||||
writeln(f);
|
||||
|
||||
/* alrogithm: filter */
|
||||
writeln("range filter test");
|
||||
auto v = { 5, 5, 5, 5, 5, 10, 15 };
|
||||
for (int i: filter(v, [](int v) { return v > 5; }))
|
||||
auto v = { 5, 5, 5, 5, 5, 10, 15, 4, 8, 2 };
|
||||
for (int i: filter(iter(v), [](int v) { return v > 5; }))
|
||||
writeln(i);
|
||||
|
||||
/* generate string ABCDEF */
|
||||
String v(map(range(6), [](int v) -> char { return v + 65; }));
|
||||
writeln(v);
|
||||
String s(map(range(6), [](int v) -> char { return v + 65; }));
|
||||
writeln(s);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#include <ostd/functional.hh>
|
||||
#include <ostd/stream.hh>
|
||||
#include <ostd/io.hh>
|
||||
|
||||
using namespace ostd;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <ostd/algorithm.hh>
|
||||
#include <ostd/string.hh>
|
||||
#include <ostd/stream.hh>
|
||||
#include <ostd/io.hh>
|
||||
|
||||
using namespace ostd;
|
||||
|
||||
|
|
Loading…
Reference in New Issue