Example demonstrating different use-cases of dash::min_element
.
#include <unistd.h>
#include <iostream>
#include <sstream>
#include <libdash.h>
int a;
double b;
std::ostream & operator<<(std::ostream & os,
const test_t & test)
{
std::ostringstream ss;
ss <<
"test_t(a:" << test.
a <<
" b:" << test.
b <<
")";
return operator<<(os, ss.str());
}
int main(int argc, char * argv[])
{
cout <<
"Unit " <<
dash::myid() <<
" PID: " << getpid()
<< endl;
for (
auto i = 0; i < arr.
size(); i++ ) {
arr[i] = i;
}
}
cout << "dash::min_element on dash::Array<int>" << endl;
}
while (it != arr.
end()) {
std::stringstream ss;
ss << "Min: " << (int)(*min) << endl;
cout << ss.str();
}
it++;
}
for (
auto & el : arr2.
local) {
el = {rand() % 100, 23.3};
}
cout << "dash::min_element on dash::Array<test_t>" << endl;
}
return t1.a < t2.a;
}
);
cout <<
"Min. test_t: " << ((
test_t)*min).a
<< endl;
}
}