rsx/util: Add a simple wrapper for simple_array<T>::for_each
- Just calls std::for_each behind the scenes but it's a lot more convenient
This commit is contained in:
@@ -634,5 +634,11 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
return accumulate;
|
return accumulate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename F>
|
||||||
|
void for_each(F&& func)
|
||||||
|
{
|
||||||
|
std::for_each(begin(), end(), func);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,6 +378,21 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(SimpleArray, ForEach)
|
||||||
|
{
|
||||||
|
rsx::simple_array<int> arr{
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
|
||||||
|
};
|
||||||
|
arr.for_each(FN(x += 10));
|
||||||
|
|
||||||
|
EXPECT_EQ(arr.size(), 10);
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(arr[i], i + 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST(AlignedAllocator, Alloc)
|
TEST(AlignedAllocator, Alloc)
|
||||||
{
|
{
|
||||||
auto ptr = rsx::aligned_allocator::malloc<256>(16);
|
auto ptr = rsx::aligned_allocator::malloc<256>(16);
|
||||||
|
|||||||
Reference in New Issue
Block a user