PIVector iterator operators
This commit is contained in:
10
main.cpp
10
main.cpp
@@ -1,13 +1,13 @@
|
||||
#include "pip.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
PIVector <int> v(5, [](size_t i){return i*2;});
|
||||
v.prepend({1, 2, 3});
|
||||
piCout << v;
|
||||
piCout << v.reduce<int>([](int v, int s){return v+s;});
|
||||
piCout << v.reduce<PIString>([](int v, PIString s){return s+PIString::fromNumber(v);});
|
||||
PIStringList sl = v.map<PIString>([](int v){return PIString::fromNumber(v);});
|
||||
piCout << sl;
|
||||
for (auto i: v) piCout << i;
|
||||
piCout << "sz" << v.end() - v.begin();
|
||||
std::sort(v.begin(), v.end());
|
||||
piCout << v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user