Run clang-format

This commit is contained in:
Bassem Girgis
2018-10-18 00:40:34 -05:00
parent fffe4528da
commit 31c32e368a
149 changed files with 5974 additions and 6287 deletions

View File

@@ -1,24 +1,22 @@
template<typename Iterator,typename Func>
void parallel_for_each(Iterator first,Iterator last,Func f)
template <typename Iterator, typename Func>
void
parallel_for_each(Iterator first, Iterator last, Func f)
{
unsigned long const length=std::distance(first,last);
unsigned long const length = std::distance(first, last);
if(!length)
return;
if (!length)
return;
unsigned long const min_per_thread=25;
unsigned long const min_per_thread = 25;
if(length<(2*min_per_thread))
{
std::for_each(first,last,f);
}
else
{
Iterator const mid_point=first+length/2;
std::future<void> first_half=
std::async(&parallel_for_each<Iterator,Func>,
first,mid_point,f);
parallel_for_each(mid_point,last,f);
first_half.get();
}
if (length < (2 * min_per_thread)) {
std::for_each(first, last, f);
}
else {
Iterator const mid_point = first + length / 2;
std::future<void> first_half =
std::async(&parallel_for_each<Iterator, Func>, first, mid_point, f);
parallel_for_each(mid_point, last, f);
first_half.get();
}
}