fix examples

master
Daniel Kolesa 2016-02-01 23:10:05 +00:00
parent 9380d2f430
commit d0bb1cfc16
3 changed files with 8 additions and 8 deletions

View File

@ -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);
}

View File

@ -1,5 +1,5 @@
#include <ostd/functional.hh>
#include <ostd/stream.hh>
#include <ostd/io.hh>
using namespace ostd;

View File

@ -1,6 +1,6 @@
#include <ostd/algorithm.hh>
#include <ostd/string.hh>
#include <ostd/stream.hh>
#include <ostd/io.hh>
using namespace ostd;