mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-05-07 13:37:46 +00:00
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:
parent
48e2d808c9
commit
278daddd2a
2 changed files with 21 additions and 0 deletions
|
|
@ -634,5 +634,11 @@ namespace rsx
|
|||
}
|
||||
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)
|
||||
{
|
||||
auto ptr = rsx::aligned_allocator::malloc<256>(16);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue